Mixer_UI::Mixer_UI ()
: Window (Gtk::WINDOW_TOPLEVEL)
{
- _strip_width = Wide;
+ session = 0;
+ _strip_width = Config->get_default_narrow_ms() ? Narrow : Wide;
track_menu = 0;
mix_group_context_menu = 0;
no_track_list_redisplay = false;
in_group_row_change = false;
_visible = false;
+ ignore_route_reorder = false;
+ ignore_sync = false;
+
+ Route::SyncOrderKeys.connect (mem_fun (*this, &Mixer_UI::sync_order_keys));
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
scroller_base.set_name ("MixerWindow");
track_model->signal_row_deleted().connect (mem_fun (*this, &Mixer_UI::track_list_delete));
track_model->signal_row_changed().connect (mem_fun (*this, &Mixer_UI::track_list_change));
+ track_model->signal_rows_reordered().connect (mem_fun (*this, &Mixer_UI::track_list_reorder));
CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (1));
track_list_visible_cell->property_activatable() = true;
list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler),
static_cast<Gtk::Paned*> (&list_hpane)));
-
- rhs_pane1.set_data ("collapse-direction", (gpointer) 0);
- list_hpane.set_data ("collapse-direction", (gpointer) 1);
-
global_vpacker.pack_start (list_hpane, true, true);
add (global_vpacker);
signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
_selection.RoutesChanged.connect (mem_fun(*this, &Mixer_UI::follow_strip_selection));
-
+
mix_group_display_button_box->show();
mix_group_add_button->show();
mix_group_remove_button->show();
list_hpane.show();
track_display.show();
group_display.show();
+
+ auto_rebinding = FALSE;
}
Mixer_UI::~Mixer_UI ()
strip = new MixerStrip (*this, *session, route);
strips.push_back (strip);
+ Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
+
+ Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide;
+
if (strip->width_owner() != strip) {
strip->set_width (_strip_width, this);
}
row[track_columns.route] = route;
row[track_columns.strip] = strip;
+ strip->set_old_order_key (track_model->children().size() - 1);
+
no_track_list_redisplay = false;
redisplay_track_list ();
Mixer_UI::remove_strip (MixerStrip* strip)
{
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
-
+
TreeModel::Children rows = track_model->children();
TreeModel::Children::iterator ri;
list<MixerStrip *>::iterator i;
strips.erase (i);
}
+ /* Decrement old order keys for strips `above' the one that is being removed */
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ MixerStrip* s = (*ri)[track_columns.strip];
+ if (s->old_order_key() > strip->old_order_key()) {
+ s->set_old_order_key (s->old_order_key() - 1);
+ }
+ }
+
for (ri = rows.begin(); ri != rows.end(); ++ri) {
if ((*ri)[track_columns.strip] == strip) {
track_model->erase (ri);
}
}
+const char*
+Mixer_UI::get_order_key()
+{
+ if (Config->get_sync_all_route_ordering()) {
+ return X_("editor");
+ } else {
+ return X_("signal");
+ }
+}
+
+void
+Mixer_UI::sync_order_keys ()
+{
+ vector<int> neworder;
+ TreeModel::Children rows = track_model->children();
+ TreeModel::Children::iterator ri;
+
+ if (ignore_sync || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
+ return;
+ }
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ neworder.push_back (0);
+ }
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ boost::shared_ptr<Route> route = (*ri)[track_columns.route];
+ MixerStrip* strip = (*ri)[track_columns.strip];
+ neworder[route->order_key (get_order_key())] = strip->old_order_key ();
+ }
+
+ ignore_route_reorder = true;
+ track_model->reorder (neworder);
+ ignore_route_reorder = false;
+}
+
void
Mixer_UI::follow_strip_selection ()
{
if (_selection.selected (strip->route())) {
_selection.remove (strip->route());
} else {
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
_selection.add (strip->route());
} else {
_selection.set (strip->route());
set_all_audio_visibility (1, false);
}
+void
+Mixer_UI::track_list_reorder (const TreeModel::Path& path, const TreeModel::iterator& iter, int* new_order)
+{
+ session->set_remote_control_ids();
+ redisplay_track_list ();
+}
+
void
Mixer_UI::track_list_change (const Gtk::TreeModel::Path& path,const Gtk::TreeModel::iterator& iter)
{
Mixer_UI::track_list_delete (const Gtk::TreeModel::Path& path)
{
session->set_remote_control_ids();
+ ignore_route_reorder = true;
redisplay_track_list ();
+ ignore_route_reorder = false;
}
void
strip->set_marked_for_display (true);
strip->route()->set_order_key (N_("signal"), order);
+ if (!ignore_route_reorder) {
+ strip->route()->set_order_key (get_order_key(), order);
+ }
+
if (strip->packed()) {
if (strip->route()->is_master() || strip->route()->is_control()) {
}
}
}
+
+ if (Config->get_sync_all_route_ordering() && !ignore_route_reorder) {
+ ignore_sync = true;
+ Route::SyncOrderKeys (); // EMIT SIGNAL
+ ignore_sync = false;
+ }
+
+ // Rebind all of the midi controls automatically
+
+ if (auto_rebinding)
+ auto_rebind_midi_controls ();
+
+}
+
+void
+Mixer_UI::set_auto_rebinding( bool val )
+{
+ if( val == TRUE )
+ {
+ auto_rebinding = TRUE;
+ Session::AutoBindingOff();
+ }
+ else
+ {
+ auto_rebinding = FALSE;
+ Session::AutoBindingOn();
+ }
+}
+
+void
+Mixer_UI::toggle_auto_rebinding()
+{
+ if (auto_rebinding)
+ {
+ set_auto_rebinding( FALSE );
+ }
+
+ else
+ {
+ set_auto_rebinding( TRUE );
+ }
+
+ auto_rebind_midi_controls();
+}
+
+void
+Mixer_UI::auto_rebind_midi_controls ()
+{
+ TreeModel::Children rows = track_model->children();
+ TreeModel::Children::iterator i;
+ int pos;
+
+ // Create bindings for all visible strips and remove those that are not visible
+ pos = 1; // 0 is reserved for the master strip
+ for (i = rows.begin(); i != rows.end(); ++i) {
+ MixerStrip* strip = (*i)[track_columns.strip];
+
+ if ( (*i)[track_columns.visible] == true ) { // add bindings for
+ // make the actual binding
+ //cout<<"Auto Binding: Visible Strip Found: "<<strip->name()<<endl;
+
+ int controlValue = pos;
+ if( strip->route()->is_master() ) {
+ controlValue = 0;
+ }
+ else {
+ pos++;
+ }
+
+ PBD::Controllable::CreateBinding ( strip->solo_button->get_controllable().get(), controlValue, 0);
+ PBD::Controllable::CreateBinding ( strip->mute_button->get_controllable().get(), controlValue, 1);
+
+ if( strip->is_audio_track() ) {
+ PBD::Controllable::CreateBinding ( strip->rec_enable_button->get_controllable().get(), controlValue, 2);
+ }
+
+ PBD::Controllable::CreateBinding ( strip->gpm.get_controllable().get(), controlValue, 3);
+ PBD::Controllable::CreateBinding ( strip->panners.get_controllable().get(), controlValue, 4);
+
+ }
+ else { // Remove any existing binding
+ PBD::Controllable::DeleteBinding ( strip->solo_button->get_controllable().get() );
+ PBD::Controllable::DeleteBinding ( strip->mute_button->get_controllable().get() );
+
+ if( strip->is_audio_track() ) {
+ PBD::Controllable::DeleteBinding ( strip->rec_enable_button->get_controllable().get() );
+ }
+
+ PBD::Controllable::DeleteBinding ( strip->gpm.get_controllable().get() );
+ PBD::Controllable::DeleteBinding ( strip->panners.get_controllable().get() ); // This only takes the first panner if there are multiples...
+ }
+
+ } // for
+
}
struct SignalOrderRouteSorter {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
/* use of ">" forces the correct sort order */
- return a->order_key ("signal") < b->order_key ("signal");
+ return a->order_key (Mixer_UI::get_order_key()) < b->order_key (Mixer_UI::get_order_key());
}
};
if (name != group->name()) {
group->set_name (name);
}
+
}
void