more solo model work, including a GUI fix for mute button state when the route is...
[ardour.git] / gtk2_ardour / editor_selection.cc
index 34238781907b88f7d420439afa949e6c8e76bcdd..fda5155e03d1fe6ed69505ab4f2bf8c253b8383a 100644 (file)
@@ -23,7 +23,6 @@
 #include "pbd/stacktrace.h"
 
 #include "ardour/session.h"
-#include "ardour/diskstream.h"
 #include "ardour/playlist.h"
 #include "ardour/route_group.h"
 #include "ardour/profile.h"
@@ -292,7 +291,7 @@ Editor::get_onscreen_tracks (TrackViewList& tvl)
  */
 
 void
-Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis, RouteGroup::Property prop) const
+Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis, PBD::PropertyID prop) const
 {
        RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
        if (route_basis == 0) {
@@ -303,7 +302,7 @@ Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeA
        tracks.insert (route_basis);
 
        RouteGroup* group = route_basis->route()->route_group();
-       if (group && group->active_property (prop)) {
+       if (group && group->enabled_property (prop)) {
 
                /* the basis is a member of an active route group, with the appropriate
                   properties; find other members */
@@ -329,9 +328,9 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
        boost::shared_ptr<Playlist> pl;
        vector<boost::shared_ptr<Region> > results;
        RegionView* marv;
-       boost::shared_ptr<Diskstream> ds;
+       boost::shared_ptr<Track> tr;
 
-       if ((ds = tv.get_diskstream()) == 0) {
+       if ((tr = tv.track()) == 0) {
                /* bus */
                return;
        }
@@ -341,7 +340,7 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
                return;
        }
 
-       if ((pl = ds->playlist()) != 0) {
+       if ((pl = tr->playlist()) != 0) {
                pl->get_equivalent_regions (basis->region(), results);
        }
 
@@ -353,9 +352,9 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
 }
 
 void
-Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, RouteGroup::Property prop) const
+Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, PBD::PropertyID property) const
 {
-       mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview(), prop);
+       mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview(), property);
 
        /* add clicked regionview since we skipped all other regions in the same track as the one it was in */
 
@@ -363,7 +362,7 @@ Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivale
 }
 
 RegionSelection
-Editor::get_equivalent_regions (RegionSelection & basis, RouteGroup::Property prop) const
+Editor::get_equivalent_regions (RegionSelection & basis, PBD::PropertyID prop) const
 {
        RegionSelection equivalent;
 
@@ -401,14 +400,14 @@ Editor::get_regionview_count_from_region_list (boost::shared_ptr<Region> region)
                        boost::shared_ptr<Playlist> pl;
                        vector<boost::shared_ptr<Region> > results;
                        RegionView* marv;
-                       boost::shared_ptr<Diskstream> ds;
+                       boost::shared_ptr<Track> tr;
 
-                       if ((ds = tatv->get_diskstream()) == 0) {
+                       if ((tr = tatv->track()) == 0) {
                                /* bus */
                                continue;
                        }
 
-                       if ((pl = (ds->playlist())) != 0) {
+                       if ((pl = (tr->playlist())) != 0) {
                                pl->get_region_list_equivalent_regions (region, results);
                        }
 
@@ -476,7 +475,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
                                if (press) {
 
                                        if (selection->selected (clicked_routeview)) {
-                                               get_equivalent_regions (clicked_regionview, all_equivalent_regions, RouteGroup::Select);
+                                               get_equivalent_regions (clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
                                        } else {
                                                all_equivalent_regions.push_back (clicked_regionview);
                                        }
@@ -494,7 +493,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
 
                case Selection::Set:
                        if (!selection->selected (clicked_regionview)) {
-                               get_equivalent_regions (clicked_regionview, all_equivalent_regions, RouteGroup::Select);
+                               get_equivalent_regions (clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
                                selection->set (all_equivalent_regions);
                                commit = true;
                        } else {
@@ -873,12 +872,11 @@ Editor::region_selection_changed ()
        _regions->unselect_all ();
 
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-
                (*i)->set_selected_regionviews (selection->regions);
-               _regions->set_selected (selection->regions);
-
        }
 
+       _regions->set_selected (selection->regions);
+
        sensitize_the_right_region_actions (!selection->regions.empty());
 
        _regions->block_change_connection (false);
@@ -980,12 +978,9 @@ Editor::invert_selection ()
  *  @param bottom Bottom (higher) y limit in trackview coordinates.
  */
 bool
-Editor::select_all_within (
-       nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op
-       )
+Editor::select_all_within (nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
 {
        list<Selectable*> found;
-       TrackViewList tracks;
 
        for (TrackViewList::const_iterator iter = tracklist.begin(); iter != tracklist.end(); ++iter) {
                
@@ -993,37 +988,13 @@ Editor::select_all_within (
                        continue;
                }
 
-               list<Selectable*>::size_type const n = found.size ();
-
                (*iter)->get_selectables (start, end, top, bot, found);
-
-               if (n != found.size()) {
-                       tracks.push_back (*iter);
-               }
        }
        
        if (found.empty()) {
                return false;
        }
 
-       if (!tracks.empty()) {
-
-               switch (op) {
-               case Selection::Add:
-                       selection->add (tracks);
-                       break;
-               case Selection::Toggle:
-                       selection->toggle (tracks);
-                       break;
-               case Selection::Set:
-                       selection->set (tracks);
-                       break;
-               case Selection::Extend:
-                       /* not defined yet */
-                       break;
-               }
-       }
-
        begin_reversible_command (_("select all within"));
        switch (op) {
        case Selection::Add:
@@ -1418,12 +1389,14 @@ Editor::deselect_all ()
        selection->clear ();
 }
 
-void
+long
 Editor::select_range_around_region (RegionView* rv)
 {
+       assert (rv);
+       
        selection->set (&rv->get_time_axis_view());
        
        selection->time.clear ();
        boost::shared_ptr<Region> r = rv->region ();
-       selection->set (r->position(), r->position() + r->length());
+       return selection->set (r->position(), r->position() + r->length());
 }