#include <map>
#include <sigc++/bind.h>
+#include <boost/foreach.hpp>
+
#include <gtkmm/accelmap.h>
#include "pbd/convert.h"
#include "ui_config.h"
#include "vca_master_strip.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
, _following_editor_selection (false)
, _maximised (false)
, _show_mixer_list (true)
+ , myactions (X_("mixer"))
{
- PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_presentation_info, this), gui_context());
-
- /* bindings was already set in MixerActor constructor */
-
+ register_actions ();
+ load_bindings ();
_content.set_data ("ardour-bindings", bindings);
+ PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_presentation_info, this), gui_context());
+
scroller.set_can_default (true);
// set_default (scroller);
stripable->presentation_info().set_hidden (!visible);
if (order != stripable->presentation_info().order()) {
- stripable->set_presentation_order_explicit (order);
+ stripable->set_presentation_order (order, false);
change = true;
}
_selection.clear_routes ();
for (TrackViewList::iterator i = s.begin(); i != s.end(); ++i) {
- RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
- if (rtav) {
- MixerStrip* ms = strip_by_route (rtav->route());
- if (ms) {
- _selection.add (ms);
+ TimeAxisView* tav = dynamic_cast<TimeAxisView*> (*i);
+ if (tav) {
+ AxisView* axis = axis_by_stripable (tav->stripable());
+ if (axis) {
+ _selection.add (axis);
}
}
}
MixerStrip*
-Mixer_UI::strip_by_route (boost::shared_ptr<Route> r)
+Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) const
{
- for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
+ for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
if ((*i)->route() == r) {
return (*i);
}
return 0;
}
+AxisView*
+Mixer_UI::axis_by_stripable (boost::shared_ptr<Stripable> s) const
+{
+ for (list<MixerStrip *>::const_iterator i = strips.begin(); i != strips.end(); ++i) {
+ if ((*i)->stripable() == s) {
+ return (*i);
+ }
+ }
+
+ return 0;
+}
+
bool
Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
{
/* primary-click: toggle selection state of strip */
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
_selection.remove (strip);
- } else if (_selection.routes.size() > 1) {
+ } else if (_selection.axes.size() > 1) {
/* de-select others */
_selection.set (strip);
}
MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
if (strip == ms) {
(*i)[stripable_columns.visible] = true;
- redisplay_track_list ();
+ av->set_marked_for_display (true);
+ update_track_visibility ();
break;
}
}
MixerStrip* strip = dynamic_cast<MixerStrip*> (av);
if (strip == ms) {
(*i)[stripable_columns.visible] = false;
- redisplay_track_list ();
+ av->set_marked_for_display (false);
+ update_track_visibility ();
break;
}
}
}
void
-Mixer_UI::set_route_targets_for_operation ()
+Mixer_UI::set_axis_targets_for_operation ()
{
- _route_targets.clear ();
+ _axis_targets.clear ();
if (!_selection.empty()) {
- _route_targets = _selection.routes;
+ _axis_targets = _selection.axes;
return;
}
boost::shared_ptr<RouteList> rl (new RouteList);
bool onoff = false;
- set_route_targets_for_operation ();
+ set_axis_targets_for_operation ();
- for (RouteUISelection::iterator r = _route_targets.begin(); r != _route_targets.end(); ++r) {
- boost::shared_ptr<MidiTrack> mt = (*r)->midi_track();
+ for (AxisViewSelection::iterator r = _axis_targets.begin(); r != _axis_targets.end(); ++r) {
+ boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> ((*r)->stripable());
if (mt) {
- rl->push_back ((*r)->route());
+ rl->push_back (mt);
onoff = !mt->input_active();
}
}
Gtk::Menu* m = manage (new Menu);
MenuList& items = m->items ();
- if (_selection.routes.empty()) {
+ if (_selection.axes.empty()) {
items.push_back (MenuElem (_("No Track/Bus is selected.")));
} else {
items.push_back (MenuElem (_("Add at the top"),
void
Mixer_UI::add_favorite_processor (ARDOUR::PluginPresetPtr ppp, ProcessorPosition pos)
{
- if (!_session || _selection.routes.empty()) {
+ if (!_session || _selection.axes.empty()) {
return;
}
PluginInfoPtr pip = ppp->_pip;
- for (RouteUISelection::iterator i = _selection.routes.begin(); i != _selection.routes.end(); ++i) {
- boost::shared_ptr<ARDOUR::Route> rt = (*i)->route();
- if (!rt) { continue; }
+ for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) {
+ boost::shared_ptr<ARDOUR::Route> rt = boost::dynamic_pointer_cast<ARDOUR::Route> ((*i)->stripable());
+
+ if (!rt) {
+ continue;
+ }
PluginPtr p = pip->load (*_session);
- if (!p) { continue; }
+
+ if (!p) {
+ continue;
+ }
if (ppp->_preset.valid) {
p->load_preset (ppp->_preset);
{
return vca == spilled_vca.lock();
}
+
+void
+Mixer_UI::register_actions ()
+{
+ Glib::RefPtr<ActionGroup> group = myactions.create_action_group (X_("Mixer"));
+
+ myactions.register_action (group, "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::solo_action));
+ myactions.register_action (group, "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::mute_action));
+ myactions.register_action (group, "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::rec_enable_action));
+ myactions.register_action (group, "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_up_action));
+ myactions.register_action (group, "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::step_gain_down_action));
+ myactions.register_action (group, "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &Mixer_UI::unity_gain_action));
+
+
+ myactions.register_action (group, "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::copy_processors));
+ myactions.register_action (group, "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::cut_processors));
+ myactions.register_action (group, "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::paste_processors));
+ myactions.register_action (group, "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::delete_processors));
+ myactions.register_action (group, "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &Mixer_UI::select_all_processors));
+ myactions.register_action (group, "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &Mixer_UI::toggle_processors));
+ myactions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins));
+ myactions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none));
+
+ myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left));
+ myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_right));
+
+ myactions.register_action (group, "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
+ sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_midi_input_active), false));
+}
+
+void
+Mixer_UI::load_bindings ()
+{
+ bindings = Bindings::get_bindings (X_("Mixer"), myactions);
+}
+
+template<class T> void
+Mixer_UI::control_action (boost::shared_ptr<T> (Stripable::*get_control)() const)
+{
+ boost::shared_ptr<ControlList> cl (new ControlList);
+ boost::shared_ptr<AutomationControl> ac;
+ bool val = false;
+ bool have_val = false;
+
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ boost::shared_ptr<Stripable> s = r->stripable();
+ if (s) {
+ ac = (s.get()->*get_control)();
+ if (ac) {
+ cl->push_back (ac);
+ if (!have_val) {
+ val = !ac->get_value();
+ have_val = true;
+ }
+ }
+ }
+ }
+
+ _session->set_controls (cl, val, Controllable::UseGroup);
+}
+
+void
+Mixer_UI::solo_action ()
+{
+ control_action (&Stripable::solo_control);
+}
+
+void
+Mixer_UI::mute_action ()
+{
+ control_action (&Stripable::mute_control);
+}
+
+void
+Mixer_UI::rec_enable_action ()
+{
+ control_action (&Stripable::rec_enable_control);
+}
+
+void
+Mixer_UI::step_gain_up_action ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->step_gain_up ();
+ }
+ }
+}
+
+void
+Mixer_UI::step_gain_down_action ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->step_gain_down ();
+ }
+ }
+}
+
+void
+Mixer_UI::unity_gain_action ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ boost::shared_ptr<Stripable> s = r->stripable();
+ if (s) {
+ boost::shared_ptr<AutomationControl> ac = s->gain_control();
+ if (ac) {
+ ac->set_value (1.0, Controllable::UseGroup);
+ }
+ }
+ }
+}
+
+void
+Mixer_UI::copy_processors ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->copy_processors ();
+ }
+ }
+}
+void
+Mixer_UI::cut_processors ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->cut_processors ();
+ }
+ }
+}
+void
+Mixer_UI::paste_processors ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->paste_processors ();
+ }
+ }
+}
+void
+Mixer_UI::select_all_processors ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->select_all_processors ();
+ }
+ }
+}
+void
+Mixer_UI::toggle_processors ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->toggle_processors ();
+ }
+ }
+}
+void
+Mixer_UI::ab_plugins ()
+{
+ set_axis_targets_for_operation ();
+
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->ab_plugins ();
+ }
+ }
+}
+
+void
+Mixer_UI::vca_assign (boost::shared_ptr<VCA> vca)
+{
+ set_axis_targets_for_operation ();
+#if 0
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->vca_assign (vca);
+ }
+ }
+#endif
+}
+
+void
+Mixer_UI::vca_unassign (boost::shared_ptr<VCA> vca)
+{
+ set_axis_targets_for_operation ();
+#if 0
+ BOOST_FOREACH(AxisView* r, _axis_targets) {
+ MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+ if (ms) {
+ ms->vca_unassign (vca);
+ }
+ }
+#endif
+}