rename latched solo option and reverse its meaning; add exclusive solo button functio...
[ardour.git] / gtk2_ardour / region_selection.cc
index 0970e435b1178f0ab57efc3d1635fea0746c7b9b..9ac96d682ba35db73a54687c48dbe9862593c4f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2006 Paul Davis 
+    Copyright (C) 2006 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
 
 #include "ardour/region.h"
 
+#include "gui_thread.h"
 #include "region_view.h"
 #include "region_selection.h"
 #include "time_axis_view.h"
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
-using namespace sigc;
 
 /** Construct an empty RegionSelection.
  */
 RegionSelection::RegionSelection ()
 {
-       RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
 
        _current_start = 0;
        _current_end = 0;
@@ -44,15 +44,15 @@ RegionSelection::RegionSelection ()
  */
 RegionSelection::RegionSelection (const RegionSelection& other)
        : std::list<RegionView*>()
-       , sigc::trackable(other)
 {
-       RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
+       RegionView::RegionViewGoingAway.connect (death_connection, MISSING_INVALIDATOR, ui_bind (&RegionSelection::remove_it, this, _1), gui_context());
+
+       _current_start = other._current_start;
+       _current_end = other._current_end;
 
        for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
                add (*i);
        }
-       _current_start = other._current_start;
-       _current_end = other._current_end;
 }
 
 /** operator= to set a RegionSelection to be the same as another.
@@ -64,13 +64,13 @@ RegionSelection::operator= (const RegionSelection& other)
        if (this != &other) {
 
                clear_all();
-               
-               for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
-                       add (*i);
-               }
 
                _current_start = other._current_start;
                _current_end = other._current_end;
+
+               for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
+                       add (*i);
+               }
        }
 
        return *this;
@@ -111,11 +111,11 @@ RegionSelection::add (RegionView* rv)
        if (rv->region()->first_frame() < _current_start || empty()) {
                _current_start = rv->region()->first_frame();
        }
-       
+
        if (rv->region()->last_frame() > _current_end || empty()) {
                _current_end = rv->region()->last_frame();
        }
-       
+
        push_back (rv);
 
        /* add to layer sorted list */
@@ -147,7 +147,7 @@ RegionSelection::remove (RegionView* rv)
 
                // remove from layer sorted list
                _bylayer.remove (rv);
-               
+
                if (size() == 1) {
 
                        /* this is the last one, so when we delete it
@@ -158,37 +158,37 @@ RegionSelection::remove (RegionView* rv)
                        _current_end = 0;
 
                } else {
-                       
+
                        boost::shared_ptr<Region> region ((*r)->region());
-                       
+
                        if (region->first_frame() == _current_start) {
-                               
+
                                /* reset current start */
-                               
+
                                nframes_t ref = max_frames;
-                               
+
                                for (RegionSelection::iterator i = begin (); i != end(); ++i) {
                                        if (region->first_frame() < ref) {
                                                ref = region->first_frame();
                                        }
                                }
-                               
+
                                _current_start = ref;
-                               
+
                        }
-                       
+
                        if (region->last_frame() == _current_end) {
 
                                /* reset current end */
-                               
+
                                nframes_t ref = 0;
-                               
+
                                for (RegionSelection::iterator i = begin (); i != end(); ++i) {
                                        if (region->first_frame() > ref) {
                                                ref = region->first_frame();
                                        }
                                }
-                               
+
                                _current_end = ref;
                        }
                }
@@ -250,13 +250,13 @@ RegionSelection::by_position (list<RegionView*>& foo) const
 
 struct RegionSortByTrack {
     bool operator() (const RegionView* a, const RegionView* b) const {
-           
+
            /* really, track and position */
 
-           if (a->get_trackview()->order() == b->get_trackview()->order()) {
+           if (a->get_trackview().order() == b->get_trackview().order()) {
                    return a->region()->position() < b->region()->position();
            } else {
-                   return a->get_trackview()->order() < b->get_trackview()->order();
+                   return a->get_trackview().order() < b->get_trackview().order();
            }
     }
 };
@@ -295,10 +295,10 @@ RegionSelection::sort_by_position_and_track ()
  *  @return true if any of the selection's regions are on tv.
  */
 bool
-RegionSelection::involves (TimeAxisViewPtr tv) const
+RegionSelection::involves (const TimeAxisView& tv) const
 {
        for (RegionSelection::const_iterator i = begin(); i != end(); ++i) {
-               if ((*i)->get_trackview() == tv) {
+               if (&(*i)->get_trackview() == &tv) {
                        return true;
                }
        }