Fix typo in 952b8e1d74
[ardour.git] / gtk2_ardour / mixer_ui.cc
index 88489f8cc3e5cc1e27106a597635e724cfcacdc2..13269bb1c768ec9556fb1e0166129a4f95149512 100644 (file)
 
 #include <boost/foreach.hpp>
 
+#include <glibmm/threads.h>
+
 #include <gtkmm/accelmap.h>
+#include <gtkmm/stock.h>
 
 #include "pbd/convert.h"
 #include "pbd/stacktrace.h"
@@ -60,7 +63,6 @@
 #include "public_editor.h"
 #include "mouse_cursors.h"
 #include "ardour_ui.h"
-#include "prompter.h"
 #include "utils.h"
 #include "route_sorter.h"
 #include "actions.h"
@@ -347,6 +349,7 @@ Mixer_UI::Mixer_UI ()
        favorite_plugins_display.show();
 
        MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
+       VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
 
        /* handle escape */
 
@@ -533,7 +536,7 @@ Mixer_UI::add_stripables (StripableList& slist)
                                row[stripable_columns.strip] = vms;
                                row[stripable_columns.stripable] = vca;
 
-                               vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
+                               vms->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::vca_button_release_event), vms));
 
                        } else if ((route = boost::dynamic_pointer_cast<Route> (*s))) {
 
@@ -826,6 +829,20 @@ Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_chan
                if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll ()) {
                        move_stripable_into_view ((*_selection.axes.begin())->stripable());
                }
+
+               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) {
+                               continue;
+                       }
+                       if (vms->vca() && vms->vca()->is_selected()) {
+                               _selection.add (vms);
+                       } else {
+                               _selection.remove (vms);
+                       }
+               }
        }
 
        redisplay_track_list ();
@@ -865,6 +882,15 @@ Mixer_UI::axis_view_by_stripable (boost::shared_ptr<Stripable> s) const
                }
        }
 
+       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) {
+                       return av;
+               }
+       }
+
        return 0;
 }
 
@@ -901,6 +927,11 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
                                /* de-select others */
                                _selection.set (strip);
                        }
+                       PublicEditor& pe = PublicEditor::instance();
+                       TimeAxisView* tav = pe.time_axis_view_from_stripable (strip->stripable());
+                       if (tav) {
+                               pe.set_selected_mixer_strip (*tav);
+                       }
                } else {
                        if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
                                _selection.add (strip, true);
@@ -965,6 +996,13 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
        return true;
 }
 
+bool
+Mixer_UI::vca_button_release_event (GdkEventButton *ev, VCAMasterStrip *strip)
+{
+       _selection.set (strip);
+       return true;
+}
+
 void
 Mixer_UI::set_session (Session* sess)
 {
@@ -2017,7 +2055,7 @@ Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& con
                if (!pip->is_instrument ()) {
                        continue;
                }
-               ARDOUR_UI::instance()->session_add_midi_track ((RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order);
+               ARDOUR_UI::instance()->session_add_midi_route (true, (RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order);
                ok = true;
        }