13
0

use new ControlSlaveUI object in mixer strip

This commit is contained in:
Paul Davis 2016-06-09 12:59:18 -04:00
parent f26191382f
commit 0678d0ada1
5 changed files with 13 additions and 149 deletions

View File

@ -103,6 +103,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
, _comment_button (_("Comments"))
, trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
, _visibility (X_("mixer-element-visibility"))
, control_slave_ui (sess)
{
init ();
@ -134,6 +135,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
, _comment_button (_("Comments"))
, trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
, _visibility (X_("mixer-element-visibility"))
, control_slave_ui (sess)
{
init ();
set_route (rt);
@ -211,15 +213,6 @@ MixerStrip::init ()
}
solo_iso_table.show ();
vca_button = manage (new ArdourButton (ArdourButton::default_elements));
vca_button->set_no_show_all (true);
vca_button->set_name (X_("vca assign"));
vca_button->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
vca_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::vca_button_release), false);
UI::instance()->set_tip (*vca_button, _("VCA assignments"));
vca_button->set_text (_("-vca-"));
vca_button->show ();
rec_mon_table.set_homogeneous (true);
rec_mon_table.set_row_spacings (2);
rec_mon_table.set_col_spacings (2);
@ -315,7 +308,7 @@ MixerStrip::init ()
global_vpacker.pack_start (solo_iso_table, Gtk::PACK_SHRINK);
global_vpacker.pack_start (mute_solo_table, Gtk::PACK_SHRINK);
global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
global_vpacker.pack_start (*vca_button, Gtk::PACK_SHRINK);
global_vpacker.pack_start (control_slave_ui, Gtk::PACK_SHRINK);
global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
if (!ARDOUR::Profile->get_trx()) {
global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
@ -397,7 +390,7 @@ MixerStrip::init ()
_visibility.add (&solo_iso_table, X_("SoloIsoLock"), _("Solo Iso / Lock"), false);
_visibility.add (&output_button, X_("Output"), _("Output"), false);
_visibility.add (&_comment_button, X_("Comments"), _("Comments"), false);
_visibility.add (vca_button, X_("VCA"), _("VCA Assigns"), false);
_visibility.add (&control_slave_ui, X_("VCA"), _("VCA Assigns"), false);
parameter_changed (X_("mixer-element-visibility"));
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &MixerStrip::parameter_changed));
@ -483,6 +476,8 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
RouteUI::set_route (rt);
control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (rt));
/* ProcessorBox needs access to _route so that it can read
GUI object state.
*/
@ -650,18 +645,12 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
_route->comment_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::setup_comment_button, this), gui_context());
_route->gain_control()->MasterStatusChange.connect (route_connections,
invalidator (*this),
boost::bind (&MixerStrip::update_vca_display, this),
gui_context());
set_stuff_from_route ();
/* now force an update of all the various elements */
update_mute_display ();
update_solo_display ();
update_vca_display ();
name_changed ();
comment_changed ();
route_group_changed ();
@ -2505,100 +2494,6 @@ MixerStrip::set_meter_type (MeterType t)
gpm.set_type (t);
}
void
MixerStrip::vca_menu_toggle (Gtk::CheckMenuItem* menuitem, uint32_t n)
{
if (!_route) {
return;
}
boost::shared_ptr<VCA> vca = _session->vca_manager().vca_by_number (n);
if (!vca) {
return;
}
if (!_selected) {
/* if this strip is not selected, add it before carrying out
changes to assignment. the user probably didn't notice
that they were clicking on an unselected track.
*/
_mixer.select_strip (*this);
}
if (!menuitem->get_active()) {
_mixer.do_vca_unassign (vca);
} else {
_mixer.do_vca_assign (vca);
}
}
void
MixerStrip::vca_assign (boost::shared_ptr<VCA> vca)
{
if (!vca || !_route) {
return;
}
_route->assign (vca);
}
void
MixerStrip::vca_unassign (boost::shared_ptr<VCA> vca)
{
if (!_route) {
return;
}
_route->unassign (vca);
}
bool
MixerStrip::vca_button_release (GdkEventButton* ev)
{
using namespace Gtk::Menu_Helpers;
if (!_session) {
return false;
}
/* primary click only */
if (ev->button != 1) {
return false;
}
if (!_route) {
/* no route - nothing to do */
return false;
}
VCAList vcas (_session->vca_manager().vcas());
if (vcas.empty()) {
/* the button should not have been visible under these conditions */
return true;
}
Menu* menu = new Menu;
MenuList& items = menu->items();
items.push_back (MenuElem (_("Unassign"), sigc::bind (sigc::mem_fun (_mixer, &Mixer_UI::do_vca_unassign), boost::shared_ptr<VCA>())));
for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
items.push_back (CheckMenuElem ((*v)->name()));
Gtk::CheckMenuItem* item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
if (_route->slaved_to (*v)) {
item->set_active (true);
}
item->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &MixerStrip::vca_menu_toggle), item, (*v)->number()));
}
menu->popup (1, ev->time);
return true;
}
void
MixerStrip::update_track_number_visibility ()
{

View File

@ -48,6 +48,7 @@
#include "pbd/fastlog.h"
#include "axis_view.h"
#include "control_slave_ui.h"
#include "ardour_knob.h"
#include "route_ui.h"
#include "gain_meter.h"
@ -137,9 +138,6 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
void toggle_processors ();
void ab_plugins ();
void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
void show_selected ();
static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
@ -330,10 +328,9 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
std::string meter_point_string (ARDOUR::MeterPoint);
void vca_menu_toggle (Gtk::CheckMenuItem*, uint32_t n);
bool vca_button_release (GdkEventButton* ev);
void update_track_number_visibility ();
ControlSlaveUI control_slave_ui;
};
#endif /* __ardour_mixer_strip__ */

View File

@ -153,7 +153,6 @@ RouteUI::init ()
multiple_mute_change = false;
multiple_solo_change = false;
_i_am_the_modifier = 0;
vca_button = 0;
input_selector = 0;
output_selector = 0;
@ -1287,34 +1286,6 @@ RouteUI::update_mute_display ()
mute_button->set_active_state (mute_active_state (_session, _route));
}
void
RouteUI::update_vca_display ()
{
if (!vca_button) {
return;
}
VCAList vcas (_session->vca_manager().vcas());
string label;
for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
if (_route->slaved_to (*v)) {
if (!label.empty()) {
label += ' ';
}
label += PBD::to_string ((*v)->number(), std::dec);
}
}
if (label.empty()) {
label = _("-vca-");
vca_button->set_active_state (Gtkmm2ext::Off);
} else {
vca_button->set_active_state (Gtkmm2ext::ExplicitActive);
}
vca_button->set_text (label);
}
void
RouteUI::route_rec_enable_changed ()

View File

@ -56,6 +56,7 @@ namespace Gtk {
class ArdourButton;
class ArdourWindow;
class IOSelectorWindow;
class ControlSlaveUI;
class RoutePinWindowProxy : public WM::ProxyBase
{
@ -126,7 +127,6 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab
ArdourButton* solo_safe_led;
ArdourButton* solo_isolated_led;
ArdourButton* vca_button;
Gtk::Label monitor_input_button_label;
Gtk::Label monitor_disk_button_label;
@ -241,8 +241,6 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab
void update_solo_display ();
void update_vca_display ();
virtual void map_frozen ();
void adjust_latency ();
@ -325,6 +323,8 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab
SoloMuteRelease* _solo_release;
SoloMuteRelease* _mute_release;
ControlSlaveUI* csu;
private:
void setup_invert_buttons ();
void set_invert_button_state ();

View File

@ -63,6 +63,7 @@ gtk2_ardour_sources = [
'configinfo.cc',
'control_point.cc',
'control_point_dialog.cc',
'control_slave_ui.cc',
'cursor_context.cc',
'curvetest.cc',
'debug.cc',