first compiling, mostly working version of group controls changes
[ardour.git] / gtk2_ardour / editor_canvas_events.cc
index c439bdaaa39cfad450d4623b70f031d16e7d207e..58e3dda285f40eaf54c1fec6baeff82b8896ab24 100644 (file)
@@ -75,11 +75,11 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
        switch (direction) {
        case GDK_SCROLL_UP:
                if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
-                       //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;
+                       if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) {
+                               temporal_zoom_step_mouse_focus (false);
+                       } else {
+                               temporal_zoom_step (false);
+                       }
                        return true;
                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
                        scroll_left_step ();
@@ -104,11 +104,11 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
 
        case GDK_SCROLL_DOWN:
                if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
-                       //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;
+                       if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) {
+                               temporal_zoom_step_mouse_focus (true);
+                       } else {
+                               temporal_zoom_step (true);
+                       }
                        return true;
                } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
                        scroll_right_step ();
@@ -1018,7 +1018,6 @@ Editor::canvas_meter_marker_event (GdkEvent *event, ArdourCanvas::Item* item, Me
 bool
 Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType type)
 {
-       framepos_t xdelta;
        bool handled = false;
 
        if (event->type == GDK_SCROLL) {
@@ -1029,13 +1028,11 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
 
                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;
+                       if (Keyboard::modifier_state_equals(event->scroll.state,
+                                                           Keyboard::ScrollHorizontalModifier)) {
+                               scroll_left_half_page ();
+                       } else if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) {
+                               temporal_zoom_step_mouse_focus (false);
                        } else {
                                temporal_zoom_step (false);
                        }
@@ -1043,12 +1040,11 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
                        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;
+                       if (Keyboard::modifier_state_equals(event->scroll.state,
+                                                           Keyboard::ScrollHorizontalModifier)) {
+                               scroll_right_half_page ();
+                       } else if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) {
+                               temporal_zoom_step_mouse_focus (true);
                        } else {
                                temporal_zoom_step (true);
                        }
@@ -1056,22 +1052,12 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType
                        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);
-                       }
+                       scroll_left_half_page ();
                        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());
-                       }
+                       scroll_right_half_page ();
                        handled = true;
                        break;