diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-06-09 13:12:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-06-09 13:12:09 -0400 |
commit | 3670f1adac3e50c9840d2215cd0441d97255e357 (patch) | |
tree | 1b9717b3f5370ed84448c652aedd306b64967c4b /gtk2_ardour/control_slave_ui.cc | |
parent | 0678d0ada1bfb1eaebb1e4d761ea0336b3537cbf (diff) |
use ControlSlaveUI in VCAMasterStrip
Diffstat (limited to 'gtk2_ardour/control_slave_ui.cc')
-rw-r--r-- | gtk2_ardour/control_slave_ui.cc | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/gtk2_ardour/control_slave_ui.cc b/gtk2_ardour/control_slave_ui.cc index 7be2d5daba..12a3495293 100644 --- a/gtk2_ardour/control_slave_ui.cc +++ b/gtk2_ardour/control_slave_ui.cc @@ -172,19 +172,41 @@ ControlSlaveUI::vca_button_release (GdkEventButton* ev, uint32_t n) Menu* menu = new Menu; MenuList& items = menu->items(); + bool slaved = false; for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { + + boost::shared_ptr<GainControl> gcs = stripable->gain_control(); + boost::shared_ptr<GainControl> gcm = (*v)->gain_control(); + + if (gcs == gcm) { + /* asked to slave to self. not ok */ + continue; + } + + if (gcm->slaved_to (gcs)) { + /* master is already slaved to slave */ + continue; + } + items.push_back (CheckMenuElem ((*v)->name())); Gtk::CheckMenuItem* item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back()); - if (stripable->gain_control()->slaved_to ((*v)->gain_control())) { + + if (gcs->slaved_to (gcm)) { item->set_active (true); + slaved = true; } + item->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &ControlSlaveUI::vca_menu_toggle), item, (*v)->number())); } - items.push_back (MenuElem (_("Unassign All"), sigc::mem_fun (*this, &ControlSlaveUI::unassign_all))); + if (slaved) { + items.push_back (MenuElem (_("Unassign All"), sigc::mem_fun (*this, &ControlSlaveUI::unassign_all))); + } - menu->popup (1, ev->time); + if (!items.empty()) { + menu->popup (1, ev->time); + } return true; } |