+bool
+Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType type)
+{
+ framepos_t xdelta;
+ bool handled = false;
+
+ if (event->type == GDK_SCROLL) {
+
+ /* scroll events in the rulers are handled a little differently from
+ scrolling elsewhere in the canvas.
+ */
+
+ switch (event->scroll.direction) {
+ case GDK_SCROLL_UP:
+
+ if (Profile->get_mixbus()) {
+ //for mouse-wheel zoom, force zoom-focus to mouse
+ Editing::ZoomFocus temp_focus = zoom_focus;
+ zoom_focus = Editing::ZoomFocusMouse;
+ temporal_zoom_step (false);
+ zoom_focus = temp_focus;
+ } else {
+ temporal_zoom_step (false);
+ }
+ handled = true;
+ break;
+
+ case GDK_SCROLL_DOWN:
+ if (Profile->get_mixbus()) {
+ //for mouse-wheel zoom, force zoom-focus to mouse
+ Editing::ZoomFocus temp_focus = zoom_focus;
+ zoom_focus = Editing::ZoomFocusMouse;
+ temporal_zoom_step (true);
+ zoom_focus = temp_focus;
+ } else {
+ temporal_zoom_step (true);
+ }
+ handled = true;
+ break;
+
+ case GDK_SCROLL_LEFT:
+ xdelta = (current_page_samples() / 2);
+ if (leftmost_frame > xdelta) {
+ reset_x_origin (leftmost_frame - xdelta);
+ } else {
+ reset_x_origin (0);
+ }
+ handled = true;
+ break;
+
+ case GDK_SCROLL_RIGHT:
+ xdelta = (current_page_samples() / 2);
+ if (max_framepos - xdelta > leftmost_frame) {
+ reset_x_origin (leftmost_frame + xdelta);
+ } else {
+ reset_x_origin (max_framepos - current_page_samples());
+ }
+ handled = true;
+ break;
+
+ default:
+ /* what? */
+ break;
+ }
+ return handled;
+ }
+
+ return typed_event (item, event, type);
+}
+