summaryrefslogtreecommitdiff
path: root/gtk2_ardour/mixer_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-01-28 16:48:20 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2017-01-28 16:48:20 +0100
commitc98abcf2931c3d58a1aa0d82ce7f06801d004423 (patch)
tree5716955396b9464310c3a19c8bcee444dc28d88d /gtk2_ardour/mixer_ui.cc
parentc7863289664f0c847f6a5e1c0fa5b4c731c134d3 (diff)
improve the behaviour of Mixer_UI::move_stripable_into_view()
Don't change anything if the strip is visible; if we have to move to show it, try to show the requested strip in the middle
Diffstat (limited to 'gtk2_ardour/mixer_ui.cc')
-rw-r--r--gtk2_ardour/mixer_ui.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 05c2a51f62..a0e4322d40 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -1598,7 +1598,15 @@ Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
}
Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
- scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), x0 - 1.0)));
+
+ if ((x0 < adj->get_value()) || x0 >= (adj->get_value() + adj->get_page_size())) {
+ /* try to put left edge of strip in the middle */
+ double half_page = adj->get_page_size() / 2.0;
+ if (x0 >= half_page) {
+ x0 -= half_page;
+ }
+ adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
+ }
}
void