+void Tracks::roll_tracks(Track *src, Track *dst, int n)
+{
+ if( src == dst ) return;
+ while( --n >= 0 && src ) {
+ Track *nxt = src->next;
+ change_modules(number_of(src), total(), 0);
+ for( Track *track=nxt; track; track=track->next )
+ change_modules(number_of(track), number_of(track)-1, 0);
+ remove_pointer(src);
+ int ndst = dst ? number_of(dst) : total();
+ insert_before(dst, src);
+ for( Track *track=last; track && track!=src; track=track->previous )
+ change_modules(number_of(track)-1, number_of(track), 0);
+ change_modules(total(), ndst, 0);
+ src = nxt;
+ }
+}
+
+double Tracks::align_timecodes()
+{
+ double offset = -1;
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->is_armed() ) continue;
+ double early_offset = track->edits->early_timecode();
+ if( offset < 0 || offset > early_offset )
+ offset = early_offset;
+ }
+ if( offset >= 0 ) {
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->is_armed() ) continue;
+ track->edits->align_timecodes(offset);
+ }
+ }
+ return offset;
+}
+
+void Tracks::update_idxbl_length(int id, double dt)
+{
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->is_armed() ) continue;
+ int64_t du = track->to_units(dt,0);
+ track->edits->update_idxbl_length(id, du);
+ track->optimize();
+ }
+}
+
+void Tracks::create_keyframes(double position, int mask, int mode)
+{
+ for( Track *track=first; track; track=track->next ) {
+ if( !track->is_armed() ) continue;
+ track->create_keyframes(position, mask, mode);
+ }
+}
+