diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-21 18:37:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-21 18:37:00 +0000 |
commit | cdf37e613b773c5b64e82697f36a489d6bd40771 (patch) | |
tree | 8d9eff90fca9f487a87c099fd13aa148844c6ee0 /libs/ardour | |
parent | 280ade047c5fc2f8ae7a9ed004810f144e4be096 (diff) |
fix deadlock in playlist::partition(); new first idle model, including message about loading visual data; make h-faders use scroll up/down and be scalable-clickable; new track menu stuff (waveform scaling/shape); fix up ordering of ruler menus; fix initial sensitivity of region menu operations
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3097 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/playlist.cc | 236 |
1 files changed, 119 insertions, 117 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 9ed103b67c..55b30b6c70 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -669,53 +669,55 @@ Playlist::partition (nframes_t start, nframes_t end, bool just_top_level) void Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist) { - RegionLock rlock (this); - boost::shared_ptr<Region> region; - boost::shared_ptr<Region> current; - string new_name; - RegionList::iterator tmp; - OverlapType overlap; - nframes_t pos1, pos2, pos3, pos4; RegionList new_regions; - in_partition = true; - - /* need to work from a copy, because otherwise the regions we add during the process - get operated on as well. - */ - - RegionList copy = regions; - - for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) { + { + RegionLock rlock (this); + boost::shared_ptr<Region> region; + boost::shared_ptr<Region> current; + string new_name; + RegionList::iterator tmp; + OverlapType overlap; + nframes_t pos1, pos2, pos3, pos4; - tmp = i; - ++tmp; - - current = *i; + in_partition = true; - if (current->first_frame() == start && current->last_frame() == end) { - if (cutting) { - remove_region_internal (current); - } - continue; - } + /* need to work from a copy, because otherwise the regions we add during the process + get operated on as well. + */ - if ((overlap = current->coverage (start, end)) == OverlapNone) { - continue; - } + RegionList copy = regions; - pos1 = current->position(); - pos2 = start; - pos3 = end; - pos4 = current->last_frame(); - - if (overlap == OverlapInternal) { + for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) { - /* split: we need 3 new regions, the front, middle and end. - cut: we need 2 regions, the front and end. - */ + tmp = i; + ++tmp; + + current = *i; + + if (current->first_frame() == start && current->last_frame() == end) { + if (cutting) { + remove_region_internal (current); + } + continue; + } + + if ((overlap = current->coverage (start, end)) == OverlapNone) { + continue; + } + + pos1 = current->position(); + pos2 = start; + pos3 = end; + pos4 = current->last_frame(); - /* + if (overlap == OverlapInternal) { + + /* split: we need 3 new regions, the front, middle and end. + cut: we need 2 regions, the front and end. + */ + + /* start end ---------------*************************------------ P1 P2 P3 P4 @@ -724,37 +726,37 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT ---------------*****----------------====------------ - */ + */ - if (!cutting) { + if (!cutting) { - /* "middle" ++++++ */ + /* "middle" ++++++ */ + + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit)); + add_region_internal (region, start); + new_regions.push_back (region); + } + /* "end" ====== */ + _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit)); - add_region_internal (region, start); + region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); + + add_region_internal (region, end); new_regions.push_back (region); - } - - /* "end" ====== */ - - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); - - add_region_internal (region, end); - new_regions.push_back (region); - - /* "front" ***** */ - current->freeze (); - thawlist.push_back (current); - current->trim_end (pos2, this); - - } else if (overlap == OverlapEnd) { - - /* + /* "front" ***** */ + + current->freeze (); + thawlist.push_back (current); + current->trim_end (pos2, this); + + } else if (overlap == OverlapEnd) { + + /* start end ---------------*************************------------ P1 P2 P4 P3 @@ -762,33 +764,32 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi ---------------**************+++++++++++------------ CUT: ---------------**************----------------------- - - */ - - if (!cutting) { + */ - /* end +++++ */ + if (!cutting) { + + /* end +++++ */ + + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(), + Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit)); + add_region_internal (region, start); + new_regions.push_back (region); + } - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(), - Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit)); - add_region_internal (region, start); - new_regions.push_back (region); - } - - /* front ****** */ - - current->freeze (); - thawlist.push_back (current); - current->trim_end (pos2, this); - - } else if (overlap == OverlapStart) { - - /* split: we need 2 regions: the front and the end. - cut: just trim current to skip the cut area - */ + /* front ****** */ + + current->freeze (); + thawlist.push_back (current); + current->trim_end (pos2, this); + + } else if (overlap == OverlapStart) { + + /* split: we need 2 regions: the front and the end. + cut: just trim current to skip the cut area + */ - /* + /* start end ---------------*************************------------ P2 P1 P3 P4 @@ -798,31 +799,31 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT: -------------------*********************------------ - */ + */ - if (!cutting) { + if (!cutting) { - /* front **** */ - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, 0, pos3 - pos1, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); - add_region_internal (region, pos1); - new_regions.push_back (region); - } - - /* end */ - - current->freeze (); - thawlist.push_back (current); - current->trim_front (pos3, this); - - } else if (overlap == OverlapExternal) { - - /* split: no split required. - cut: remove the region. - */ + /* front **** */ + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, 0, pos3 - pos1, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); + add_region_internal (region, pos1); + new_regions.push_back (region); + } + + /* end */ + + current->freeze (); + thawlist.push_back (current); + current->trim_front (pos3, this); + + } else if (overlap == OverlapExternal) { - /* + /* split: no split required. + cut: remove the region. + */ + + /* start end ---------------*************************------------ P2 P1 P3 P4 @@ -832,16 +833,17 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT: ---------------------------------------------------- - */ - - if (cutting) { - remove_region_internal (current); + */ + + if (cutting) { + remove_region_internal (current); + } + new_regions.push_back (current); } - new_regions.push_back (current); } - } - in_partition = false; + in_partition = false; + } for (RegionList::iterator i = new_regions.begin(); i != new_regions.end(); ++i) { check_dependents (*i, false); |