Remove unused method in RouteTimeAxisView. Fix bug with switching to layered region mode.
Optimise Playlist::relayer(). git-svn-id: svn://localhost/ardour2/branches/3.0@5572 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c91da28eb2
commit
09eee1bb7c
@ -303,21 +303,6 @@ RouteTimeAxisView::post_construct ()
|
||||
reset_processor_automation_curves ();
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::set_playlist (boost::shared_ptr<Playlist> /*newplaylist*/)
|
||||
{
|
||||
boost::shared_ptr<Playlist> pl = playlist();
|
||||
assert(pl);
|
||||
|
||||
modified_connection.disconnect ();
|
||||
modified_connection = pl->Modified.connect (mem_fun(*this, &RouteTimeAxisView::playlist_modified));
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::playlist_modified ()
|
||||
{
|
||||
}
|
||||
|
||||
gint
|
||||
RouteTimeAxisView::edit_click (GdkEventButton *ev)
|
||||
{
|
||||
@ -342,10 +327,6 @@ void
|
||||
RouteTimeAxisView::playlist_changed ()
|
||||
{
|
||||
label_view ();
|
||||
|
||||
if (is_track()) {
|
||||
set_playlist (get_diskstream()->playlist());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1163,7 +1144,6 @@ RouteTimeAxisView::update_diskstream_display ()
|
||||
if (!get_diskstream()) // bus
|
||||
return;
|
||||
|
||||
set_playlist (get_diskstream()->playlist());
|
||||
map_frozen ();
|
||||
}
|
||||
|
||||
|
@ -236,11 +236,9 @@ protected:
|
||||
void align_style_changed ();
|
||||
void set_align_style (ARDOUR::AlignStyle);
|
||||
|
||||
virtual void set_playlist (boost::shared_ptr<ARDOUR::Playlist>);
|
||||
void playlist_click ();
|
||||
void show_playlist_selector ();
|
||||
void playlist_changed ();
|
||||
void playlist_modified ();
|
||||
|
||||
void rename_current_playlist ();
|
||||
|
||||
@ -312,8 +310,6 @@ protected:
|
||||
|
||||
AutomationTracks _automation_tracks;
|
||||
|
||||
sigc::connection modified_connection;
|
||||
|
||||
void post_construct ();
|
||||
|
||||
GainMeterBase gm;
|
||||
|
@ -312,11 +312,13 @@ StreamView::playlist_modified (boost::shared_ptr<Diskstream> ds)
|
||||
ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_modified_weak), ds));
|
||||
|
||||
/* update layers count and the y positions and heights of our regions */
|
||||
if (ds->playlist() && _layer_display == Stacked) {
|
||||
if (ds->playlist()) {
|
||||
_layers = ds->playlist()->top_layer() + 1;
|
||||
}
|
||||
|
||||
if (_layer_display == Stacked) {
|
||||
update_contents_height ();
|
||||
update_coverage_frames ();
|
||||
//redisplay_diskstream ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,7 +360,7 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
|
||||
/* catch changes */
|
||||
|
||||
playlist_connections.push_back (ds->playlist()->Modified.connect (bind (
|
||||
mem_fun (*this, &StreamView::playlist_modified_weak), ds)));
|
||||
mem_fun (*this, &StreamView::playlist_modified_weak), ds)));
|
||||
|
||||
playlist_connections.push_back (ds->playlist()->RegionAdded.connect (
|
||||
mem_fun (*this, &StreamView::add_region_view_weak)));
|
||||
|
@ -454,7 +454,7 @@ Playlist::flush_notifications ()
|
||||
relayer ();
|
||||
}
|
||||
pending_modified = false;
|
||||
Modified (); /* EMIT SIGNAL */
|
||||
Modified (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
for (s = dependent_checks_needed.begin(); s != dependent_checks_needed.end(); ++s) {
|
||||
@ -1834,15 +1834,17 @@ Playlist::set_state (const XMLNode& node)
|
||||
XMLNode&
|
||||
Playlist::get_state()
|
||||
{
|
||||
return state(true);
|
||||
return state (true);
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
Playlist::get_template()
|
||||
{
|
||||
return state(false);
|
||||
return state (false);
|
||||
}
|
||||
|
||||
/** @param full_state true to include regions in the returned state, otherwise false.
|
||||
*/
|
||||
XMLNode&
|
||||
Playlist::state (bool full_state)
|
||||
{
|
||||
@ -1951,9 +1953,27 @@ Playlist::relayer ()
|
||||
|
||||
freeze ();
|
||||
|
||||
/* build up a new list of regions on each layer */
|
||||
/* Build up a new list of regions on each layer, stored in a set of lists
|
||||
each of which represent some period of time on some layer. The idea
|
||||
is to avoid having to search the entire region list to establish whether
|
||||
each region overlaps another */
|
||||
|
||||
std::vector<RegionList> layers;
|
||||
/* how many pieces to divide this playlist's time up into */
|
||||
int const divisions = 512;
|
||||
|
||||
/* find the start and end positions of the regions on this playlist */
|
||||
nframes_t start = UINT_MAX;
|
||||
nframes_t end = 0;
|
||||
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
start = min (start, (*i)->position());
|
||||
end = max (end, (*i)->position() + (*i)->length());
|
||||
}
|
||||
|
||||
/* hence the size of each time division */
|
||||
double const division_size = (end - start) / divisions;
|
||||
|
||||
vector<vector<RegionList> > layers;
|
||||
layers.push_back (vector<RegionList> (divisions));
|
||||
|
||||
/* we want to go through regions from desired lowest to desired highest layer,
|
||||
which depends on the layer model
|
||||
@ -1967,44 +1987,58 @@ Playlist::relayer ()
|
||||
RegionSortByLastLayerOp cmp;
|
||||
copy.sort (cmp);
|
||||
}
|
||||
|
||||
|
||||
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
|
||||
|
||||
/* find the time divisions that this region covers */
|
||||
int const start_division = floor ( ((*i)->position() - start) / division_size);
|
||||
int end_division = floor ( ((*i)->position() + (*i)->length() - start) / division_size );
|
||||
if (end_division == divisions) {
|
||||
end_division--;
|
||||
}
|
||||
|
||||
/* find the lowest layer that this region can go on */
|
||||
size_t j = layers.size();
|
||||
while (j > 0) {
|
||||
/* try layer j - 1; it can go on if it overlaps no other region
|
||||
that is already on that layer
|
||||
*/
|
||||
RegionList::iterator k = layers[j - 1].begin();
|
||||
while (k != layers[j - 1].end()) {
|
||||
if ((*k)->overlap_equivalent (*i)) {
|
||||
|
||||
bool overlap = false;
|
||||
for (int k = start_division; k <= end_division; ++k) {
|
||||
RegionList::iterator l = layers[j-1][k].begin ();
|
||||
while (l != layers[j-1][k].end()) {
|
||||
if ((*l)->overlap_equivalent (*i)) {
|
||||
overlap = true;
|
||||
break;
|
||||
}
|
||||
l++;
|
||||
}
|
||||
|
||||
if (overlap) {
|
||||
break;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
|
||||
if (k != layers[j - 1].end()) {
|
||||
/* no overlap, so we can use this layer */
|
||||
if (overlap) {
|
||||
/* overlap, so we must use layer j */
|
||||
break;
|
||||
}
|
||||
|
||||
j--;
|
||||
|
||||
--j;
|
||||
}
|
||||
|
||||
if (j == layers.size()) {
|
||||
/* we need a new layer for this region */
|
||||
layers.push_back (RegionList ());
|
||||
layers.push_back (vector<RegionList> (divisions));
|
||||
}
|
||||
|
||||
layers[j].push_back (*i);
|
||||
}
|
||||
|
||||
/* first pass: set up the layer numbers in the regions */
|
||||
for (size_t j = 0; j < layers.size(); ++j) {
|
||||
for (RegionList::iterator i = layers[j].begin(); i != layers[j].end(); ++i) {
|
||||
(*i)->set_layer (j);
|
||||
/* put a reference to this region in each of the divisions that it exists in */
|
||||
for (int k = start_division; k <= end_division; ++k) {
|
||||
layers[j][k].push_back (*i);
|
||||
}
|
||||
|
||||
(*i)->set_layer (j);
|
||||
}
|
||||
|
||||
/* sending Modified means that various kinds of layering
|
||||
|
Loading…
Reference in New Issue
Block a user