many changes associated with rationalizing selection flow
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 6 Jul 2016 17:37:30 +0000 (13:37 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 6 Jul 2016 17:39:10 +0000 (13:39 -0400)
33 files changed:
gtk2_ardour/axis_view.cc
gtk2_ardour/axis_view.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_mixer.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/meter_strip.cc
gtk2_ardour/meter_strip.h
gtk2_ardour/mixer_actor.cc
gtk2_ardour/mixer_actor.h
gtk2_ardour/mixer_group_tabs.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/port_group.cc
gtk2_ardour/public_editor.h
gtk2_ardour/route_processor_selection.cc
gtk2_ardour/route_processor_selection.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/route_ui_selection.h
gtk2_ardour/selectable.h
gtk2_ardour/selection.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h
gtk2_ardour/track_selection.cc
gtk2_ardour/vca_master_strip.cc
gtk2_ardour/vca_master_strip.h

index 25a190729516dc4650d424446b4748cc5bbfe680..d87768703973d30c758e4a1b39d673a9b5e4bdf0 100644 (file)
@@ -97,3 +97,19 @@ AxisView::gui_object_state()
 {
        return *ARDOUR_UI::instance()->gui_object_state;
 }
+
+void
+AxisView::set_selected (bool yn)
+{
+       if (selected() == yn) {
+               return;
+       }
+
+       Selectable::set_selected (yn);
+
+       boost::shared_ptr<Stripable> s = stripable ();
+
+       if (s) {
+               s->presentation_info().set_selected (yn);
+       }
+}
index bc16aed06b7ce58b68d29957e8c69f131134be21..2a7c3781978d92d8ea5e959c4ed794a2a9fe3cf5 100644 (file)
 
 namespace ARDOUR {
        class Session;
+       class Stripable;
+       class PresentationInfo;
 }
 
 /**
- * AxisView defines the abstract base class for time-axis trackviews and routes.
+ * AxisView defines the abstract base class for horizontal and vertical
+ * presentations of Stripables.
  *
  */
 class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable
@@ -53,6 +56,8 @@ class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR
 
        sigc::signal<void> Hiding;
 
+       virtual boost::shared_ptr<ARDOUR::Stripable> stripable() const = 0;
+
        virtual std::string state_id() const = 0;
        /* for now, we always return properties in string form.
         */
@@ -72,6 +77,8 @@ class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR
                property_hashtable.clear ();
        }
 
+       void set_selected (bool yn);
+
        virtual bool marked_for_display () const;
        virtual bool set_marked_for_display (bool);
 
index 146a4e7e4475bac60dbe2dead96d9427b435ed90..20547e8e18ba8df8d342b0021f13ba5fe695ef24 100644 (file)
@@ -805,6 +805,12 @@ Editor::Editor ()
        ControlProtocol::VerticalZoomInSelected.connect (*this, invalidator (*this), boost::bind (&Editor::control_vertical_zoom_in_selected, this), gui_context());
        ControlProtocol::VerticalZoomOutSelected.connect (*this, invalidator (*this), boost::bind (&Editor::control_vertical_zoom_out_selected, this), gui_context());
 
+       ControlProtocol::AddStripableToSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Add), gui_context());
+       ControlProtocol::RemoveStripableFromSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Toggle), gui_context());
+       ControlProtocol::SetStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Set), gui_context());
+       ControlProtocol::ToggleStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_select, this, _1, Selection::Toggle), gui_context());
+       ControlProtocol::ClearStripableSelection.connect (*this, invalidator (*this), boost::bind (&Editor::control_unselect, this), gui_context());
+
        BasicUI::AccessAction.connect (*this, invalidator (*this), boost::bind (&Editor::access_action, this, _1, _2), gui_context());
 
        /* handle escape */
@@ -1006,6 +1012,30 @@ Editor::control_unselect ()
        selection->clear_tracks ();
 }
 
+void
+Editor::control_select (boost::shared_ptr<Stripable> s, Selection::Operation op)
+{
+       TimeAxisView* tav = axis_view_from_stripable (s);
+
+       if (tav) {
+               switch (op) {
+               case Selection::Add:
+                       selection->add (tav);
+                       break;
+               case Selection::Toggle:
+                       selection->toggle (tav);
+                       break;
+               case Selection::Extend:
+                       break;
+               case Selection::Set:
+                       selection->set (tav);
+                       break;
+               }
+       } else {
+               selection->clear_tracks ();
+       }
+}
+
 void
 Editor::control_step_tracks_up ()
 {
@@ -5155,16 +5185,13 @@ Editor::region_view_removed ()
        _summary->set_background_dirty ();
 }
 
-RouteTimeAxisView*
-Editor::axis_view_from_route (boost::shared_ptr<Route> r) const
+TimeAxisView*
+Editor::axis_view_from_stripable (boost::shared_ptr<Stripable> s) const
 {
-       TrackViewList::const_iterator j = track_views.begin ();
-       while (j != track_views.end()) {
-               RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*j);
-               if (rtv && rtv->route() == r) {
-                       return rtv;
+       for (TrackViewList::const_iterator j = track_views.begin (); j != track_views.end(); ++j) {
+               if ((*j)->stripable() == s) {
+                       return *j;
                }
-               ++j;
        }
 
        return 0;
@@ -5177,7 +5204,7 @@ Editor::axis_views_from_routes (boost::shared_ptr<RouteList> r) const
        TrackViewList t;
 
        for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
-               TimeAxisView* tv = axis_view_from_route (*i);
+               TimeAxisView* tv = axis_view_from_stripable (*i);
                if (tv) {
                        t.push_back (tv);
                }
index ee97886f9c7e08e66dfa9132d8a6b7a21a269cd6..8bbc7fee2b263b374dfdf9d233a5e099d15dd384 100644 (file)
@@ -1091,6 +1091,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void control_step_tracks_down ();
        void control_view (uint32_t);
        void control_scroll (float);
+       void control_select (boost::shared_ptr<ARDOUR::Stripable>, Selection::Operation);
        void control_unselect ();
        void access_action (std::string,std::string);
        bool deferred_control_scroll (framepos_t);
@@ -1132,7 +1133,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        /* track views */
        TrackViewList track_views;
        std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true) const;
-       RouteTimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
+       TimeAxisView* axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
 
        TrackViewList get_tracks_for_range_action () const;
 
index 0c31135e982368c25d7e5fe1c3c03f8377224bb8..c26e4b96dc091e321e4371130a438e24e7daec3f 100644 (file)
@@ -1281,14 +1281,14 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
                                }
                                list<boost::shared_ptr<AudioTrack> > audio_tracks;
                                audio_tracks = session()->new_audio_track (region->n_channels(), output_chan, 0, 1, region->name(), PresentationInfo::max_order);
-                               rtav = axis_view_from_route (audio_tracks.front());
+                               rtav = dynamic_cast<RouteTimeAxisView*> (axis_view_from_stripable (audio_tracks.front()));
                        } else if (boost::dynamic_pointer_cast<MidiRegion> (region)) {
                                ChanCount one_midi_port (DataType::MIDI, 1);
                                list<boost::shared_ptr<MidiTrack> > midi_tracks;
                                midi_tracks = session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(),
                                                                         (ARDOUR::Plugin::PresetRecord*) 0,
                                                                         (ARDOUR::RouteGroup*) 0, 1, region->name(), PresentationInfo::max_order);
-                               rtav = axis_view_from_route (midi_tracks.front());
+                               rtav = dynamic_cast<RouteTimeAxisView*> (axis_view_from_stripable (midi_tracks.front()));
                        } else {
                                return;
                        }
index d2fd96e685f14943779812d992c706b2c228d091..c5e72fb778940939276f9e52afa6a18a5a01d380 100644 (file)
@@ -527,7 +527,7 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit)
 
 struct PresentationInfoTimeAxisViewSorter {
        bool operator() (TimeAxisView* a, TimeAxisView* b) {
-               return a->presentation_info().order() < b->presentation_info().order();
+               return a->stripable()->presentation_info().order() < b->stripable()->presentation_info().order();
        }
 };
 
@@ -1395,22 +1395,22 @@ RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region,
                                output_chan =  _editor->session()->master_out()->n_inputs().n_audio();
                        }
                        audio_tracks = _editor->session()->new_audio_track (region->n_channels(), output_chan, 0, 1, region->name(), PresentationInfo::max_order);
-                       RouteTimeAxisView* rtav = _editor->axis_view_from_route (audio_tracks.front());
-                       if (rtav) {
-                               rtav->set_height (original->current_height());
+                       TimeAxisView* tav =_editor->axis_view_from_stripable (audio_tracks.front());
+                       if (tav) {
+                               tav->set_height (original->current_height());
                        }
-                       return rtav;
+                       return dynamic_cast<RouteTimeAxisView*>(tav);
                } else {
                        ChanCount one_midi_port (DataType::MIDI, 1);
                        list<boost::shared_ptr<MidiTrack> > midi_tracks;
                        midi_tracks = _editor->session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(),
                                                                          (ARDOUR::Plugin::PresetRecord*) 0,
                                                                          (ARDOUR::RouteGroup*) 0, 1, region->name(), PresentationInfo::max_order);
-                       RouteTimeAxisView* rtav = _editor->axis_view_from_route (midi_tracks.front());
-                       if (rtav) {
-                               rtav->set_height (original->current_height());
+                       TimeAxisView* tav = _editor->axis_view_from_stripable (midi_tracks.front());
+                       if (tav) {
+                               tav->set_height (original->current_height());
                        }
-                       return rtav;
+                       return dynamic_cast<RouteTimeAxisView*> (tav);
                }
        } catch (...) {
                error << _("Could not create new track after region placed in the drop zone") << endmsg;
index 67b33a6c87fd3b8e510e83d342d5bd99b802ac7b..029f6d966da8021a67c050fab700b2574f49317e 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "ardour/rc_configuration.h"
 
+#include "control_protocol/control_protocol.h"
+
 #include "actions.h"
 #include "ardour_ui.h"
 #include "audio_time_axis.h"
@@ -225,7 +227,11 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
                }
        }
 
-       _session->set_editor_mixer (route);
+       /* Typically this is set by changing the TAV selection but if for any
+          reason we decide to show a different strip for some reason, make
+          sure that control surfaces can find it.
+       */
+       ARDOUR::ControlProtocol::set_first_selected_stripable (route);
 
        Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
 
@@ -295,12 +301,12 @@ Editor::follow_mixer_selection ()
        _following_mixer_selection = true;
        selection->block_tracks_changed (true);
 
-       RouteUISelection& s (Mixer_UI::instance()->selection().routes);
+       AxisViewSelection& s (Mixer_UI::instance()->selection().axes);
 
        selection->clear_tracks ();
 
-       for (RouteUISelection::iterator i = s.begin(); i != s.end(); ++i) {
-               TimeAxisView* tav = get_route_view_by_route_id ((*i)->route()->id());
+       for (AxisViewSelection::iterator i = s.begin(); i != s.end(); ++i) {
+               TimeAxisView* tav = axis_view_from_stripable ((*i)->stripable());
                if (tav) {
                        selection->add (tav);
                }
index 9c827c141266682366e7be2b62be38034ef09f7a..e46fcfee5a28b26db43955e12a57f0924d125547 100644 (file)
@@ -1802,7 +1802,7 @@ EditorRoutes::show_tracks_with_regions_at_playhead ()
 
        set<TimeAxisView*> show;
        for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
-               TimeAxisView* tav = _editor->axis_view_from_route (*i);
+               TimeAxisView* tav = _editor->axis_view_from_stripable (*i);
                if (tav) {
                        show.insert (tav);
                }
index 1e1fd8f84a681ac94298e7d4aac6e96e511ab8da..3ab26d92bc2c08e4c16269019e5f6746ad42aee9 100644 (file)
@@ -977,3 +977,4 @@ MeterStrip::color () const
 {
        return RouteUI::route_color ();
 }
+
index 00a2c4089d8a2897ad2bbf3f02ce3bcb6751cee7..0e7232537de172bb733a237d307787c2b9e95555 100644 (file)
@@ -53,6 +53,8 @@ class MeterStrip : public Gtk::VBox, public AxisView, public RouteUI
        std::string name() const;
        Gdk::Color color () const;
 
+       boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
+
        void set_session (ARDOUR::Session* s);
        void fast_update ();
        boost::shared_ptr<ARDOUR::Route> route() { return _route; }
index 41b2c87f5fd98e97752fa6ad0ecd96a1f96c28d0..c0beee805f82e952c786bd857bfb0f4ec5520594 100644 (file)
@@ -92,57 +92,57 @@ MixerActor::load_bindings ()
 void
 MixerActor::solo_action ()
 {
-       GdkEventButton ev;
-
-       ev.type = GDK_BUTTON_PRESS;
-       ev.button = 1;
-       ev.state = 0;
-
-       set_route_targets_for_operation ();
-
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
-               r->solo_press (&ev);
+       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->solo_control();
+                       if (ac) {
+                               ac->set_value (!ac->get_value(), Controllable::UseGroup);
+                       }
+               }
        }
 }
 
 void
 MixerActor::mute_action ()
 {
-       GdkEventButton ev;
-
-       ev.type = GDK_BUTTON_PRESS;
-       ev.button = 1;
-       ev.state = 0;
-
-       set_route_targets_for_operation ();
-
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
-               r->mute_press (&ev);
+       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->mute_control();
+                       if (ac) {
+                               ac->set_value (!ac->get_value(), Controllable::UseGroup);
+                       }
+               }
        }
 }
 
 void
 MixerActor::rec_enable_action ()
 {
-       GdkEventButton ev;
-
-       ev.type = GDK_BUTTON_PRESS;
-       ev.button = 1;
-       ev.state = 0;
-
-       set_route_targets_for_operation ();
-
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
-               r->rec_enable_press (&ev);
+       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->rec_enable_control();
+                       if (ac) {
+                               ac->set_value (!ac->get_value(), Controllable::UseGroup);
+                       }
+               }
        }
 }
 
 void
 MixerActor::step_gain_up_action ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->step_gain_up ();
@@ -153,9 +153,9 @@ MixerActor::step_gain_up_action ()
 void
 MixerActor::step_gain_down_action ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->step_gain_down ();
@@ -166,13 +166,15 @@ MixerActor::step_gain_down_action ()
 void
 MixerActor::unity_gain_action ()
 {
-       set_route_targets_for_operation ();
-
-printf("setting gain to unity (?)");
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
-               boost::shared_ptr<Route> rp = r->route();
-               if (rp) {
-                       rp->gain_control()->set_value (1.0, Controllable::NoGroup);
+       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);
+                       }
                }
        }
 }
@@ -180,9 +182,9 @@ printf("setting gain to unity (?)");
 void
 MixerActor::copy_processors ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->copy_processors ();
@@ -192,9 +194,9 @@ MixerActor::copy_processors ()
 void
 MixerActor::cut_processors ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->cut_processors ();
@@ -204,9 +206,9 @@ MixerActor::cut_processors ()
 void
 MixerActor::paste_processors ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->paste_processors ();
@@ -216,9 +218,9 @@ MixerActor::paste_processors ()
 void
 MixerActor::select_all_processors ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->select_all_processors ();
@@ -228,9 +230,9 @@ MixerActor::select_all_processors ()
 void
 MixerActor::toggle_processors ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->toggle_processors ();
@@ -240,9 +242,9 @@ MixerActor::toggle_processors ()
 void
 MixerActor::ab_plugins ()
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->ab_plugins ();
@@ -253,9 +255,9 @@ MixerActor::ab_plugins ()
 void
 MixerActor::vca_assign (boost::shared_ptr<VCA> vca)
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 #if 0
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->vca_assign (vca);
@@ -267,9 +269,9 @@ MixerActor::vca_assign (boost::shared_ptr<VCA> vca)
 void
 MixerActor::vca_unassign (boost::shared_ptr<VCA> vca)
 {
-       set_route_targets_for_operation ();
+       set_axis_targets_for_operation ();
 #if 0
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
+       BOOST_FOREACH(AxisView* r, _axis_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
                        ms->vca_unassign (vca);
index 16b450133d9e9e5fcacfb41c1021281ab224621d..a2f4522afbecd7e6456db1fdd30ac01723fcbc0a 100644 (file)
@@ -48,9 +48,9 @@ class MixerActor : virtual public sigc::trackable
   protected:
        Gtkmm2ext::ActionMap myactions;
        RouteProcessorSelection _selection;
-       RouteUISelection _route_targets;
+       AxisViewSelection _axis_targets;
 
-       virtual void set_route_targets_for_operation () = 0;
+       virtual void set_axis_targets_for_operation () = 0;
 
        void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
        void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
index 373e5eee1a2cea714b3d649f56b2bf0b4eb4eb0c..25dbae44843a23b6450616c94f3ba9fe569d5e98 100644 (file)
@@ -186,8 +186,8 @@ RouteList
 MixerGroupTabs::selected_routes () const
 {
        RouteList rl;
-       BOOST_FOREACH (RouteUI* r, _mixer->selection().routes) {
-               boost::shared_ptr<Route> rp = r->route();
+       BOOST_FOREACH (AxisView* r, _mixer->selection().axes) {
+               boost::shared_ptr<Route> rp = boost::dynamic_pointer_cast<Route> (r->stripable());
                if (rp) {
                        rl.push_back (rp);
                }
index d7007184a75ced25d34bd30f4dc5b853e085823c..77b203e7fb12014f67afbadb42b3659a00237e9e 100644 (file)
@@ -1719,8 +1719,10 @@ MixerStrip::list_route_operations ()
 }
 
 void
-MixerStrip::show_selected ()
+MixerStrip::set_selected (bool yn)
 {
+       AxisView::set_selected (yn);
+
        if (selected()) {
                global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
                global_frame.set_name ("MixerStripSelectedFrame");
index 0d815c4b3e5448cd36a0b0286b78870dddafe050..c1c1726902aa1bf5e34e6a07072fcdd6c4bd191e 100644 (file)
@@ -88,6 +88,8 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
        bool marked_for_display () const;
        bool set_marked_for_display (bool);
 
+       boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
+
        void set_width_enum (Width, void* owner);
        Width get_width_enum () const { return _width; }
        void* width_owner () const { return _width_owner; }
@@ -138,7 +140,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
        void toggle_processors ();
        void ab_plugins ();
 
-       void show_selected ();
+       void set_selected (bool yn);
 
        static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
 
index ca0320eb6fc199bf5fe87f319c72d6b5e726162b..af621daae37060f0cdee8c5c1b74605a258e4354 100644 (file)
@@ -816,11 +816,11 @@ Mixer_UI::follow_editor_selection ()
        _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);
                        }
                }
        }
@@ -831,9 +831,9 @@ Mixer_UI::follow_editor_selection ()
 
 
 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);
                }
@@ -842,6 +842,18 @@ Mixer_UI::strip_by_route (boost::shared_ptr<Route> r)
        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)
 {
@@ -850,7 +862,7 @@ 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);
                        }
@@ -2220,12 +2232,12 @@ Mixer_UI::strip_by_x (int x)
 }
 
 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;
        }
 
@@ -2251,13 +2263,13 @@ Mixer_UI::toggle_midi_input_active (bool flip_others)
        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();
                }
        }
@@ -2458,7 +2470,7 @@ Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
        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"),
@@ -2575,17 +2587,23 @@ Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* col
 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);
index 6dc8cd2c844afa7c101fa26ac12a06d95ecbe1e0..70a0e630b73d9ac53fbc7fe11314837af1120e38 100644 (file)
@@ -121,7 +121,7 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
        sigc::signal1<void,boost::shared_ptr<ARDOUR::VCA> > show_vca_change;
 
   protected:
-       void set_route_targets_for_operation ();
+       void set_axis_targets_for_operation ();
 
   private:
        Mixer_UI ();
@@ -177,7 +177,8 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
        void add_masters (ARDOUR::VCAList&);
        void remove_master (VCAMasterStrip*);
 
-       MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>);
+       MixerStrip* strip_by_route (boost::shared_ptr<ARDOUR::Route>) const;
+       AxisView* axis_by_stripable (boost::shared_ptr<ARDOUR::Stripable>) const;
 
        void hide_all_strips (bool with_select);
        void unselect_all_strips();
index 5b9db5daf82c40869ded91c17c22d108ee834e0c..2691b46a7b8239d085f56e8e135a0702e9cc397a 100644 (file)
@@ -381,7 +381,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        */
 
        for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
-               TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->route);
+               TimeAxisView* tv = PublicEditor::instance().axis_view_from_stripable (i->route);
 
                /* Work out which group to put these IOs' bundles in */
                boost::shared_ptr<PortGroup> g;
index 836f84901858d8ba8f4bc39c3699ce50efbeee93..e562e1cb37454abe5191794092ac72bc453919a9 100644 (file)
@@ -57,6 +57,7 @@ namespace ARDOUR {
        class RouteGroup;
         class Trimmable;
         class Movable;
+        class Stripable;
 }
 
 namespace Gtk {
@@ -371,7 +372,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable {
 
         virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0;
 
-       virtual TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
+       virtual TimeAxisView* axis_view_from_stripable (boost::shared_ptr<ARDOUR::Stripable>) const = 0;
 
         virtual void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>) = 0;
         virtual void set_current_movable (boost::shared_ptr<ARDOUR::Movable>) = 0;
index 30943e22d04475765a1d4b1b07d7b815e9797b82..ed993fdc86bfe01fe1d77de5eb7ff10ee31865de 100644 (file)
@@ -42,7 +42,7 @@ RouteProcessorSelection::operator= (const RouteProcessorSelection& other)
 {
        if (&other != this) {
                processors = other.processors;
-               routes = other.routes;
+               axes = other.axes;
        }
        return *this;
 }
@@ -51,7 +51,7 @@ bool
 operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b)
 {
        // XXX MUST TEST PROCESSORS SOMEHOW
-       return a.routes == b.routes;
+       return a.axes == b.axes;
 }
 
 void
@@ -71,10 +71,10 @@ RouteProcessorSelection::clear_processors ()
 void
 RouteProcessorSelection::clear_routes ()
 {
-       for (RouteUISelection::iterator i = routes.begin(); i != routes.end(); ++i) {
+       for (AxisViewSelection::iterator i = axes.begin(); i != axes.end(); ++i) {
                (*i)->set_selected (false);
        }
-       routes.clear ();
+       axes.clear ();
        drop_connections ();
        if (!_no_route_change_signal) {
                RoutesChanged ();
@@ -98,34 +98,33 @@ RouteProcessorSelection::set (XMLNode* node)
 }
 
 void
-RouteProcessorSelection::add (RouteUI* r)
+RouteProcessorSelection::add (AxisView* r)
 {
-       if (find (routes.begin(), routes.end(), r) == routes.end()) {
-               if (routes.insert (r).second) {
-                       r->set_selected (true);
+       if (axes.insert (r).second) {
 
-                       MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
+               r->set_selected (true);
 
-                       if (ms) {
-                               ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
-                       }
+               MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
 
-                       if (!_no_route_change_signal) {
-                               RoutesChanged();
-                       }
+               if (ms) {
+                       ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
+               }
+
+               if (!_no_route_change_signal) {
+                       RoutesChanged();
                }
        }
 }
 
 void
-RouteProcessorSelection::remove (RouteUI* r)
+RouteProcessorSelection::remove (AxisView* r)
 {
        ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r);
 
-       RouteUISelection::iterator i;
-       if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
+       AxisViewSelection::iterator i;
+       if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) {
                (*i)->set_selected (false);
-               routes.erase (i);
+               axes.erase (i);
                if (!_no_route_change_signal) {
                        RoutesChanged ();
                }
@@ -133,22 +132,22 @@ RouteProcessorSelection::remove (RouteUI* r)
 }
 
 void
-RouteProcessorSelection::set (RouteUI* r)
+RouteProcessorSelection::set (AxisView* r)
 {
        clear_routes ();
        add (r);
 }
 
 bool
-RouteProcessorSelection::selected (RouteUI* r)
+RouteProcessorSelection::selected (AxisView* r)
 {
-       return find (routes.begin(), routes.end(), r) != routes.end();
+       return find (axes.begin(), axes.end(), r) != axes.end();
 }
 
 bool
 RouteProcessorSelection::empty ()
 {
-       return processors.empty () && routes.empty ();
+       return processors.empty () && axes.empty ();
 }
 
 void
index 3f8bb1a08cb445ff101a08bed62a21da70e27366..6c037d7bd9ef0aae777a2a6f25e911565834c18f 100644 (file)
@@ -30,7 +30,7 @@ class RouteProcessorSelection : public PBD::ScopedConnectionList, public sigc::t
 {
   public:
        ProcessorSelection processors;
-       RouteUISelection     routes;
+       AxisViewSelection  axes;
 
        RouteProcessorSelection();
 
@@ -47,17 +47,17 @@ class RouteProcessorSelection : public PBD::ScopedConnectionList, public sigc::t
        void set (XMLNode* node);
        void add (XMLNode* node);
 
-       void set (RouteUI*);
-       void add (RouteUI*);
-       void remove (RouteUI*);
+       void set (AxisView*);
+       void add (AxisView*);
+       void remove (AxisView*);
 
        void clear_processors ();
        void clear_routes ();
 
-       bool selected (RouteUI*);
+       bool selected (AxisView*);
 
   private:
-       void removed (RouteUI*);
+       void removed (AxisView*);
        bool _no_route_change_signal;
 
 };
index d3b28bd04218b28b9d3d170cb420a9dc9d5ffa88..7b73f36532a7f316cf7d8c579462de33dcbc111c 100644 (file)
@@ -2921,18 +2921,6 @@ RouteTimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> c)
        }
 }
 
-PresentationInfo const &
-RouteTimeAxisView::presentation_info () const
-{
-       return _route->presentation_info();
-}
-
-boost::shared_ptr<Stripable>
-RouteTimeAxisView::stripable () const
-{
-       return _route;
-}
-
 Gdk::Color
 RouteTimeAxisView::color () const
 {
index e24bd638a6cfe282afaeb1b06e0c25ee6cacaa0c..3af3f1e08eb178eeb7d993cd2c50147a6dee377a 100644 (file)
@@ -83,10 +83,9 @@ public:
        bool marked_for_display () const;
        bool set_marked_for_display (bool);
 
-       void set_route (boost::shared_ptr<ARDOUR::Route>);
+       boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
 
-       boost::shared_ptr<ARDOUR::Stripable> stripable() const;
-       ARDOUR::PresentationInfo const & presentation_info () const;
+       void set_route (boost::shared_ptr<ARDOUR::Route>);
 
        void show_selection (TimeSelection&);
        void set_button_names ();
index 7ecb4f2031ab484c3b4a8b505319947d088a4138..5b6217af4a85bb086865e5c6ac53be7b6b13bc61 100644 (file)
@@ -2144,33 +2144,6 @@ RouteUI::route_gui_changed (PropertyChange const& what_changed)
                        route_color_changed ();
                }
        }
-
-       if (what_changed.contains (Properties::selected)) {
-               show_selected ();
-       }
-}
-
-void
-RouteUI::set_selected (bool yn)
-{
-       Selectable::set_selected (yn);
-       if (_route) {
-               _route->presentation_info().set_selected (yn);
-       }
-}
-
-bool
-RouteUI::selected () const
-{
-       /* XXX not sure if this is a wise design. Probably don't really want
-        * the cached _selected value from Selectable.
-        */
-
-       if (!_route) {
-               return _selected;
-       }
-
-       return _route->presentation_info().selected();
 }
 
 void
@@ -2365,3 +2338,10 @@ RouteUI::mark_hidden (bool yn)
        }
        return false;
 }
+
+boost::shared_ptr<Stripable>
+RouteUI::stripable () const
+{
+       return _route;
+}
+
index ecd4ed520d543edecc2d516d51977f4b2f0b4a61..e05db7f67708f4f7b633f91b4e4a368af1225425 100644 (file)
@@ -74,13 +74,15 @@ class RoutePinWindowProxy : public WM::ProxyBase
        PBD::ScopedConnection going_away_connection;
 };
 
-class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectable, public virtual PBD::ScopedConnectionList
+class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual PBD::ScopedConnectionList, public virtual Selectable, public virtual sigc::trackable
 {
   public:
        RouteUI (ARDOUR::Session*);
 
        virtual ~RouteUI();
 
+       boost::shared_ptr<ARDOUR::Stripable> stripable() const;
+
        virtual void set_route (boost::shared_ptr<ARDOUR::Route>);
        virtual void set_button_names () = 0;
 
@@ -106,9 +108,6 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab
        Gdk::Color route_color () const;
        void choose_color ();
 
-       bool selected () const;
-       void set_selected (bool);
-
        bool ignore_toggle;
        bool wait_for_release;
        bool multiple_mute_change;
index b26e1c6f54af79474be880767d44f08ca5d8b82c..03935aab7b2ba58762ea218ae80f651518f80102 100644 (file)
@@ -23,8 +23,8 @@
 
 #include <set>
 
-class RouteUI;
+class AxisView;
 
-struct RouteUISelection : std::set<RouteUI*> {};
+struct AxisViewSelection : std::set<AxisView*> {};
 
 #endif /* __ardour_gtk_route_ui_selection_h__ */
index c22a1b54f6f0d51332cdebd540a0ac76200732b6..2ffac879291d46ea4767a564e22cdf4dbf71a3c6 100644 (file)
@@ -41,8 +41,6 @@ class Selectable : public virtual sigc::trackable
                return _selected;
        }
 
-       virtual void show_selected() {}
-
   protected:
        bool _selected;
 };
index fefca3d1ecf5d366ac0a12a3a1c29f1984d6b2fe..feb7b3b1a578b7680f13b05f3ad35a25a59690a0 100644 (file)
@@ -26,6 +26,8 @@
 #include "ardour/playlist.h"
 #include "ardour/rc_configuration.h"
 
+#include "control_protocol/control_protocol.h"
+
 #include "audio_region_view.h"
 #include "debug.h"
 #include "gui_thread.h"
@@ -637,6 +639,7 @@ Selection::remove (TimeAxisView* track)
        if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
                track->set_selected (false);
                tracks.erase (i);
+
                if (!_no_tracks_changed) {
                        TracksChanged();
                }
index de8c17f4566898a0ca91eda9458efccc075b134e..6a2d80e0ebeec34063783efa508ad591cc6d2dd9 100644 (file)
@@ -742,9 +742,15 @@ TimeAxisView::popup_display_menu (guint32 when)
 }
 
 void
-TimeAxisView::show_selected ()
+TimeAxisView::set_selected (bool yn)
 {
-       if (selected()) {
+       if (yn == selected()) {
+               return;
+       }
+
+       Selectable::set_selected (yn);
+
+       if (_selected) {
                time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
                time_axis_frame.set_name ("MixerStripSelectedFrame");
                controls_ebox.set_name (controls_base_selected_name);
@@ -770,6 +776,7 @@ TimeAxisView::show_selected ()
        }
 
        time_axis_frame.show();
+
 }
 
 void
index 1920d668a72e40f7b25f3b698bdbeb20a8720c43..aed4576f20d7793ebdeccc30138414a5c6913528 100644 (file)
@@ -105,9 +105,6 @@ class TimeAxisView : public virtual AxisView
 
        static void setup_sizes ();
 
-       virtual boost::shared_ptr<ARDOUR::Stripable> stripable() const = 0;
-       virtual ARDOUR::PresentationInfo const & presentation_info () const = 0;
-
        /** @return index of this TimeAxisView within its parent */
        int order () const { return _order; }
 
@@ -139,6 +136,8 @@ class TimeAxisView : public virtual AxisView
        /** @return true if hidden, otherwise false */
        bool hidden () const { return _hidden; }
 
+       void set_selected (bool);
+
        virtual bool selectable() const { return true; }
 
        /**
@@ -306,9 +305,6 @@ class TimeAxisView : public virtual AxisView
 
        void build_size_menu ();
 
-  protected:
-       void show_selected ();
-
   private:
        Gtk::VBox*            control_parent;
        int                  _order;
index 92efbd48633341a2dac34d602bc96d33550ff1a9..6937eb623d904e59c2efee001527bccee13f0cb9 100644 (file)
 */
 
 #include <algorithm>
+
 #include "ardour/route_group.h"
+#include "control_protocol/control_protocol.h"
+
 #include "track_selection.h"
 #include "time_axis_view.h"
 #include "public_editor.h"
@@ -57,4 +60,3 @@ TrackSelection::add (TrackViewList const & t)
 
        return added;
 }
-
index c0ade152af86525329303d0d1c108aa9a5733de2..3ea00b1a4707839fe348f0386dcfce23146a5273 100644 (file)
@@ -510,3 +510,16 @@ VCAMasterStrip::set_marked_for_display (bool yn)
        }
        return false;
 }
+
+PresentationInfo const &
+VCAMasterStrip::presentation_info () const
+{
+       return _vca->presentation_info();
+}
+
+boost::shared_ptr<Stripable>
+VCAMasterStrip::stripable () const
+{
+       return _vca;
+}
+
index bca74fded078c4a2f3794aa2cf0e0584fd16305b..ea8ee52f6d4a95480cd0026199dc8c3cba1c8929 100644 (file)
@@ -42,6 +42,9 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
        VCAMasterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::VCA>);
        ~VCAMasterStrip ();
 
+       boost::shared_ptr<ARDOUR::Stripable> stripable() const;
+       ARDOUR::PresentationInfo const & presentation_info () const;
+
        std::string name() const;
        Gdk::Color color () const;
        std::string state_id() const;