}
static
-void add_region_to_list (RegionView* rv, Playlist::RegionList* l, uint32_t* max_level)
+void add_region_to_list (RegionView* rv, Playlist::RegionList* l)
{
l->push_back (rv->region());
- *max_level = max (*max_level, rv->region()->max_source_level());
}
RegionView*
Playlist::RegionList selected_regions;
boost::shared_ptr<Playlist> playlist = track()->playlist();
- uint32_t max_level = 0;
- _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions, &max_level));
+ _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions));
- string name = RegionFactory::compound_region_name (playlist->name(), playlist->combine_ops(), max_level);
-
playlist->clear_changes ();
- boost::shared_ptr<Region> compound_region = playlist->combine (selected_regions, name);
+ boost::shared_ptr<Region> compound_region = playlist->combine (selected_regions);
_session->add_command (new StatefulDiffCommand (playlist));
/* make the new region be selected */
Playlist::RegionList selected_regions;
boost::shared_ptr<Playlist> playlist = track()->playlist();
- uint32_t max_level = 0;
/* have to grab selected regions first because the uncombine is going
* to change that in the middle of the list traverse
*/
- _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions, &max_level));
+ _view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions));
playlist->clear_changes ();
}
boost::shared_ptr<Region>
-Playlist::combine (const RegionList& r, const std::string& name)
+Playlist::combine (const RegionList& r)
{
PropertyList plist;
uint32_t channels = 0;
uint32_t layer = 0;
framepos_t earliest_position = max_framepos;
vector<TwoRegions> old_and_new_regions;
+ string parent_name;
+ string child_name;
+ uint32_t max_level = 0;
- boost::shared_ptr<Playlist> pl = PlaylistFactory::create (_type, _session, name, true);
+ /* find the maximum depth of all the regions we're combining */
+
+ for (RegionList::const_iterator i = r.begin(); i != r.end(); ++i) {
+ max_level = max (max_level, (*i)->max_source_level());
+ }
+
+ parent_name = RegionFactory::compound_region_name (name(), combine_ops(), max_level, true);
+ child_name = RegionFactory::compound_region_name (name(), combine_ops(), max_level, false);
+
+ boost::shared_ptr<Playlist> pl = PlaylistFactory::create (_type, _session, parent_name, true);
for (RegionList::const_iterator i = r.begin(); i != r.end(); ++i) {
earliest_position = min (earliest_position, (*i)->position());
pair<framepos_t,framepos_t> extent = pl->get_extent();
for (uint32_t chn = 0; chn < channels; ++chn) {
- sources.push_back (SourceFactory::createFromPlaylist (_type, _session, pl, name, chn, 0, extent.second, false, false));
+ sources.push_back (SourceFactory::createFromPlaylist (_type, _session, pl, parent_name, chn, 0, extent.second, false, false));
}
- /* now a new region using the list of sources */
+ /* now a new whole-file region using the list of sources */
plist.add (Properties::start, 0);
plist.add (Properties::length, extent.second);
- plist.add (Properties::name, name);
+ plist.add (Properties::name, parent_name);
+ plist.add (Properties::whole_file, true);
+
+ boost::shared_ptr<Region> parent_region = RegionFactory::create (sources, plist, true);
+
+ /* now the non-whole-file region that we will actually use in the
+ * playlist
+ */
+
+ plist.clear ();
+ plist.add (Properties::start, 0);
+ plist.add (Properties::length, extent.second);
+ plist.add (Properties::name, child_name);
plist.add (Properties::layer, layer+1);
-
- boost::shared_ptr<Region> compound_region = RegionFactory::create (sources, plist, true);
+
+ boost::shared_ptr<Region> compound_region = RegionFactory::create (parent_region, plist, true);
/* add any dependent regions to the new playlist */
pl = pls->playlist();
- framepos_t adjusted_start;
- framepos_t adjusted_end;
+ framepos_t adjusted_start = 0; // gcc isn't smart enough
+ framepos_t adjusted_end = 0; // gcc isn't smart enough
/* the leftmost (earliest) edge of the compound region
starts at zero in its source, or larger if it