aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@src.gnome.org>2000-07-08 15:18:47 +0800
committerAnders Carlsson <andersca@src.gnome.org>2000-07-08 15:18:47 +0800
commit2219b51a72c7c598777a64f1b39f329c12a7e9c6 (patch)
treea58246cb8ae77146198382c7ad8e8037531e7551
parentd93826e6b32b5ab3fde15eaa5746df1fbff76a60 (diff)
downloadgsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.gz
gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.tar.zst
gsoc2013-evolution-2219b51a72c7c598777a64f1b39f329c12a7e9c6.zip
Add mouse wheel scrolling support to the calendar day and week views
svn path=/trunk/; revision=3971
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-day-view.c48
-rw-r--r--calendar/gui/e-week-view.c14
3 files changed, 70 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 9bf6623cf1..8c54a4caed 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,11 @@
+2000-07-08 Anders Carlsson <andersca@gnu.org>
+
+ * gui/e-week-view.c (e_week_view_on_button_press): Handle mouse wheel scrolling.
+
+ * gui/e-day-view.c (e_day_view_on_time_canvas_button_press): New function to handle
+ mouse wheel scrolling.
+ (e_day_view_on_main_canvas_button_press): Handle mouse wheel scrolling.
+
2000-07-07 Federico Mena Quintero <federico@helixcode.com>
* cal-util/cal-component.c (scan_property): Handle the SEQUENCE
@@ -16,6 +24,7 @@
(cal_component_set_dtend): Ditto.
(cal_component_set_due): Ditto.
+>>>>>>> 1.434
2000-07-06 Federico Mena Quintero <federico@helixcode.com>
* cal-util/cal-component.c (scan_property): Handle the
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index ab789437e7..a0dfb177bb 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -133,6 +133,11 @@ static gboolean e_day_view_on_main_canvas_button_press (GtkWidget *widget,
static gboolean e_day_view_on_main_canvas_button_release (GtkWidget *widget,
GdkEventButton *event,
EDayView *day_view);
+
+static gboolean e_day_view_on_time_canvas_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ EDayView *day_view);
+
static void e_day_view_update_calendar_selection_time (EDayView *day_view);
static gboolean e_day_view_on_main_canvas_motion (GtkWidget *widget,
GdkEventMotion *event,
@@ -759,7 +764,11 @@ e_day_view_init (EDayView *day_view)
0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (day_view->time_canvas);
-
+ gtk_signal_connect_after (GTK_OBJECT (day_view->time_canvas),
+ "button_press_event",
+ GTK_SIGNAL_FUNC (e_day_view_on_time_canvas_button_press),
+ day_view);
+
canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->time_canvas)->root);
day_view->time_canvas_item =
@@ -1906,6 +1915,20 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
gint event_x, event_y, scroll_x, scroll_y, row, day, event_num;
EDayViewPosition pos;
+ /* Handle scroll wheel events */
+ if (event->button == 4 || event->button == 5) {
+ GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
+ gfloat new_value;
+
+ new_value = adj->value + ((event->button == 4) ?
+ -adj->page_increment / 2:
+ adj->page_increment / 2);
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
/* Convert the coords to the main canvas window, or return if the
window is not found. */
if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
@@ -1957,6 +1980,29 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
static gboolean
+e_day_view_on_time_canvas_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ EDayView *day_view)
+{
+ /* Handle scroll wheel events */
+ if (event->button == 4 || event->button == 5) {
+ GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
+ gfloat new_value;
+
+ new_value = adj->value + ((event->button == 4) ?
+ -adj->page_increment / 2:
+ adj->page_increment / 2);
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+static gboolean
e_day_view_on_long_event_button_press (EDayView *day_view,
gint event_num,
GdkEventButton *event,
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index db27ef3404..ee237abffb 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1355,6 +1355,20 @@ e_week_view_on_button_press (GtkWidget *widget,
g_print ("In e_week_view_on_button_press\n");
#endif
+ /* Handle scroll wheel events */
+ if (event->button == 4 || event->button == 5) {
+ GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
+ gfloat new_value;
+
+ new_value = adj->value + ((event->button == 4) ?
+ -adj->page_increment:
+ adj->page_increment);
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+ }
+
/* If an event is pressed just return. */
if (week_view->pressed_event_num != -1)
return FALSE;