Skip to content
Permalink
Browse files

On selection, move/scroll VCA into view

  • Loading branch information...
x42 committed Mar 14, 2019
1 parent 41e0255 commit 12fd04835868aadedb7f5e0a5f11a3cc5c2eaf0f
Showing with 43 additions and 1 deletion.
  1. +42 −1 gtk2_ardour/mixer_ui.cc
  2. +1 −0 gtk2_ardour/mixer_ui.h
@@ -1641,15 +1641,56 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev)
return false;
}

void
Mixer_UI::move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
{
if (!vca_scroller.get_hscrollbar()) {
return;
}

bool found = false;
int x0 = 0;
Gtk::Allocation alloc;

TreeModel::Children rows = track_model->children();
for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
AxisView* av = (*i)[stripable_columns.strip];
VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
if (vms && vms->stripable () == s) {
int y;
found = true;
vms->translate_coordinates (vca_hpacker, 0, 0, x0, y);
alloc = vms->get_allocation ();
break;
}
}

if (!found) {
return;
}

Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();

if (x0 < adj->get_value()) {
adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
} else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
int x1 = x0 + alloc.get_width() - adj->get_page_size();
adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
}
}

void
Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
{
if (!scroller.get_hscrollbar()) {
return;
}
if (s->presentation_info().special () || s->presentation_info().flag_match (PresentationInfo::VCA)) {
if (s->presentation_info().special ()) {
return;
}
if (s->presentation_info().flag_match (PresentationInfo::VCA)) {
move_vca_into_view (s);
}
#ifdef MIXBUS
if (s->mixbus ()) {
return;
@@ -203,6 +203,7 @@ class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionLis
void vca_scroll_right ();
void toggle_midi_input_active (bool flip_others);

void move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable>);
void move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable>);

void add_stripables (ARDOUR::StripableList&);

0 comments on commit 12fd048

Please sign in to comment.
You can’t perform that action at this time.