General SMPTE fixes mostly relating to non-integer frame rates. Please Test. Fix...
[ardour.git] / gtk2_ardour / selection.cc
index 086d878994813f56ce96e2faa98cbfd7b15b46da..38a0cdd8e2d429910c2008d148244339d2300acd 100644 (file)
@@ -84,7 +84,7 @@ Selection::dump_region_layers()
 {
        cerr << "region selection layer dump" << endl;
        for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
-               cerr << "layer: " << (int)(*i)->region().layer() << endl;
+               cerr << "layer: " << (int)(*i)->region()->layer() << endl;
        }
 }
 
@@ -132,7 +132,7 @@ Selection::clear_playlists ()
        /* Selections own their playlists */
 
        for (PlaylistSelection::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-               (*i)->unref ();
+               (*i)->release ();
        }
 
        if (!playlists.empty()) {
@@ -165,12 +165,12 @@ Selection::toggle (boost::shared_ptr<Redirect> r)
 }
 
 void
-Selection::toggle (Playlist* pl)
+Selection::toggle (boost::shared_ptr<Playlist> pl)
 {
        PlaylistSelection::iterator i;
 
        if ((i = find (playlists.begin(), playlists.end(), pl)) == playlists.end()) {
-               pl->ref ();
+               pl->use ();
                playlists.push_back(pl);
        } else {
                playlists.erase (i);
@@ -179,6 +179,14 @@ Selection::toggle (Playlist* pl)
        PlaylistsChanged ();
 }
 
+void
+Selection::toggle (const list<TimeAxisView*>& track_list)
+{
+       for (list<TimeAxisView*>::const_iterator i = track_list.begin(); i != track_list.end(); ++i) {
+               toggle ( (*i) );
+       }
+}
+
 void
 Selection::toggle (TimeAxisView* track)
 {
@@ -226,7 +234,7 @@ Selection::toggle (vector<RegionView*>& r)
 }
 
 long
-Selection::toggle (jack_nframes_t start, jack_nframes_t end)
+Selection::toggle (nframes_t start, nframes_t end)
 {
        AudioRangeComparator cmp;
 
@@ -252,23 +260,23 @@ Selection::add (boost::shared_ptr<Redirect> r)
 }
 
 void
-Selection::add (Playlist* pl)
+Selection::add (boost::shared_ptr<Playlist> pl)
 {
        if (find (playlists.begin(), playlists.end(), pl) == playlists.end()) {
-               pl->ref ();
+               pl->use ();
                playlists.push_back(pl);
                PlaylistsChanged ();
        }
 }
 
 void
-Selection::add (const list<Playlist*>& pllist)
+Selection::add (const list<boost::shared_ptr<Playlist> >& pllist)
 {
        bool changed = false;
 
-       for (list<Playlist*>::const_iterator i = pllist.begin(); i != pllist.end(); ++i) {
+       for (list<boost::shared_ptr<Playlist> >::const_iterator i = pllist.begin(); i != pllist.end(); ++i) {
                if (find (playlists.begin(), playlists.end(), (*i)) == playlists.end()) {
-                       (*i)->ref ();
+                       (*i)->use ();
                        playlists.push_back (*i);
                        changed = true;
                }
@@ -336,7 +344,7 @@ Selection::add (vector<RegionView*>& v)
 }
 
 long
-Selection::add (jack_nframes_t start, jack_nframes_t end)
+Selection::add (nframes_t start, nframes_t end)
 {
        AudioRangeComparator cmp;
 
@@ -352,7 +360,7 @@ Selection::add (jack_nframes_t start, jack_nframes_t end)
 }
 
 void
-Selection::replace (uint32_t sid, jack_nframes_t start, jack_nframes_t end)
+Selection::replace (uint32_t sid, nframes_t start, nframes_t end)
 {
        for (list<AudioRange>::iterator i = time.begin(); i != time.end(); ++i) {
                if ((*i).id == sid) {
@@ -421,9 +429,9 @@ Selection::remove (const list<TimeAxisView*>& track_list)
 }
 
 void
-Selection::remove (Playlist* track)
+Selection::remove (boost::shared_ptr<Playlist> track)
 {
-       list<Playlist*>::iterator i;
+       list<boost::shared_ptr<Playlist> >::iterator i;
        if ((i = find (playlists.begin(), playlists.end(), track)) != playlists.end()) {
                playlists.erase (i);
                PlaylistsChanged();
@@ -431,13 +439,13 @@ Selection::remove (Playlist* track)
 }
 
 void
-Selection::remove (const list<Playlist*>& pllist)
+Selection::remove (const list<boost::shared_ptr<Playlist> >& pllist)
 {
        bool changed = false;
 
-       for (list<Playlist*>::const_iterator i = pllist.begin(); i != pllist.end(); ++i) {
+       for (list<boost::shared_ptr<Playlist> >::const_iterator i = pllist.begin(); i != pllist.end(); ++i) {
 
-               list<Playlist*>::iterator x;
+               list<boost::shared_ptr<Playlist> >::iterator x;
 
                if ((x = find (playlists.begin(), playlists.end(), (*i))) != playlists.end()) {
                        playlists.erase (x);
@@ -476,7 +484,7 @@ Selection::remove (uint32_t selection_id)
 }
 
 void
-Selection::remove (jack_nframes_t start, jack_nframes_t end)
+Selection::remove (nframes_t start, nframes_t end)
 {
 }
 
@@ -512,14 +520,14 @@ Selection::set (const list<TimeAxisView*>& track_list)
 }
 
 void
-Selection::set (Playlist* playlist)
+Selection::set (boost::shared_ptr<Playlist> playlist)
 {
        clear_playlists ();
        add (playlist);
 }
 
 void
-Selection::set (const list<Playlist*>& pllist)
+Selection::set (const list<boost::shared_ptr<Playlist> >& pllist)
 {
        clear_playlists ();
        add (pllist);
@@ -542,7 +550,7 @@ Selection::set (vector<RegionView*>& v)
 }
 
 long
-Selection::set (TimeAxisView* track, jack_nframes_t start, jack_nframes_t end)
+Selection::set (TimeAxisView* track, nframes_t start, nframes_t end)
 {
        if ((start == 0 && end == 0) || end < start) {
                return 0;
@@ -616,6 +624,7 @@ Selection::set (list<Selectable*>& selectables)
        add (selectables);
 }
 
+
 void
 Selection::add (list<Selectable*>& selectables)
 {