-
- if (size() == 1) {
-
- /* this is the last one, so when we delete it
- we will be empty.
- */
-
- _current_start = 0;
- _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;
- }
- }
-