From ab292183dd090db6533acd2d761199e1911c31dc Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Thu, 7 Jan 2016 21:55:22 +1000 Subject: [PATCH] Bug #6722, Add UI config option to always use mouse position as zoom focus on scroll This means that mouse zoom scrolling behaviour is consistent on the ruler canvas area and track canvas area. The config option defaults to true so this means the behaviour of Mixbus will be unchanged but in Ardour the ruler area will now follow the option so by default will use the mouse position as zoom focus when zooming rather than the zoom focus setting. --- gtk2_ardour/editor_canvas_events.cc | 20 ++++++++++++-------- gtk2_ardour/rc_option_editor.cc | 8 ++++++++ gtk2_ardour/ui_config_vars.h | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index e821254c9b..58e3dda285 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -75,8 +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 - temporal_zoom_step_mouse_focus (false); + 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 (); @@ -101,8 +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 - temporal_zoom_step_mouse_focus (true); + 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 (); @@ -1025,8 +1031,7 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType if (Keyboard::modifier_state_equals(event->scroll.state, Keyboard::ScrollHorizontalModifier)) { scroll_left_half_page (); - } else if (Profile->get_mixbus()) { - //for mouse-wheel zoom, force zoom-focus to mouse + } else if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) { temporal_zoom_step_mouse_focus (false); } else { temporal_zoom_step (false); @@ -1038,8 +1043,7 @@ Editor::canvas_ruler_event (GdkEvent *event, ArdourCanvas::Item* item, ItemType if (Keyboard::modifier_state_equals(event->scroll.state, Keyboard::ScrollHorizontalModifier)) { scroll_right_half_page (); - } else if (Profile->get_mixbus()) { - //for mouse-wheel zoom, force zoom-focus to mouse + } else if (UIConfiguration::instance().get_use_mouse_position_as_zoom_focus_on_scroll()) { temporal_zoom_step_mouse_focus (true); } else { temporal_zoom_step (true); diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index fc904b2109..421e4c56c2 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2108,6 +2108,14 @@ if (!Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_zoom_tools), sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_zoom_tools) )); + + add_option (_("Editor"), + new BoolOption ( + "use-mouse-position-as-zoom-focus-on-scroll", + _("Always use mouse cursor position as zoom focus when zooming using mouse scroll wheel"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_mouse_position_as_zoom_focus_on_scroll), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_mouse_position_as_zoom_focus_on_scroll) + )); } // !mixbus add_option (_("Editor"), diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 2cf2855390..e512fe397b 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -49,6 +49,7 @@ UI_CONFIG_VARIABLE (bool, never_display_periodic_midi, "never-display-periodic-m UI_CONFIG_VARIABLE (bool, sound_midi_notes, "sound-midi-notes", false) UI_CONFIG_VARIABLE (bool, show_plugin_scan_window, "show-plugin-scan-window", false) UI_CONFIG_VARIABLE (bool, show_zoom_tools, "show-zoom-tools", true) +UI_CONFIG_VARIABLE (bool, use_mouse_position_as_zoom_focus_on_scroll, "use-mouse-position-as-zoom-focus-on-scroll", true) UI_CONFIG_VARIABLE (bool, widget_prelight, "widget-prelight", true) UI_CONFIG_VARIABLE (bool, use_tooltips, "use-tooltips", true) UI_CONFIG_VARIABLE (std::string, mixer_strip_visibility, "mixer-element-visibility", "Input,PhaseInvert,RecMon,SoloIsoLock,Output,Comments")