refine 29f604418, move selected track to left-edge (if possible)

This commit is contained in:
Robin Gareus 2016-10-16 21:27:07 +02:00
parent 1c9dbb5242
commit 7e5e95d7db

View File

@ -1504,13 +1504,11 @@ Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
} }
bool found = false; bool found = false;
int x0 = 0; int x0 = 0;
int x1 = 0;
for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) { for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
if ((*i)->route() == s) { if ((*i)->route() == s) {
int y; int y;
found = true; found = true;
(*i)->translate_coordinates (strip_packer, 0, 0, x0, y); (*i)->translate_coordinates (strip_packer, 0, 0, x0, y);
x1 = x0 + (*i)->get_width ();
break; break;
} }
} }
@ -1521,16 +1519,8 @@ Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
int sl = adj->get_value(); int sl = adj->get_value();
int sr = sl + scroller.get_width(); int sr = sl + scroller.get_width();
if (x0 < sl) {
scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), x0 - 1.0))); scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), x0 - 1.0)));
} }
else if (x1 > sr) {
// TODO: align left side of left most track, if possible
double re = x1 - scroller.get_width();
scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), re)));
}
}
void void
Mixer_UI::build_track_menu () Mixer_UI::build_track_menu ()