- else
- if(edit_mode == MOVE_ONE_EDIT)
- {
- if(next)
- {
- if(next->asset)
- {
- int64_t end_source = next->get_source_end(1);
-
- if(end_source > 0 && next->startsource - cut_length < 0)
- {
- cut_length = next->startsource;
- }
- }
-
- if(cut_length < length)
- {
- length -= cut_length;
- next->startproject -= cut_length;
- next->startsource -= cut_length;
- next->length += cut_length;
-//printf("Edit::shift_end_in 2 %d\n", cut_length);
+ trim(0);
+ return follow_edits(start, end, cut_length, edits_moved, rest_moved,
+ edit_labels, edit_autos, edit_plugins, trim_edits);
+}
+
+int Edit::follow_edits(int64_t start, int64_t end, int64_t cut_length,
+ int edits_moved, int rest_moved, int edit_labels, int edit_autos,
+ int edit_plugins, Edits *trim_edits)
+{
+ if( edits_moved && rest_moved ) {
+ if( edit_labels ) {
+ double cut_len = track->from_units(cut_length);
+ double start_pos = edits->track->from_units(start);
+ if( cut_len < 0 )
+ edits->edl->labels->clear(start_pos + cut_len, start_pos, 1);
+ else if( cut_len > 0 )
+ edits->edl->labels->insert(start_pos, cut_len);
+ }
+ if( cut_length < 0 )
+ track->clear(start + cut_length, start,
+ 0, 0, edit_autos, edit_plugins, trim_edits);
+ else if( cut_length > 0 ) {
+ if( edit_autos )
+ track->shift_keyframes(start, cut_length);
+ if( edit_plugins )
+ track->shift_effects(start, cut_length, 1, trim_edits);
+ }
+ }
+ else if( edits_moved ) {
+ if( edit_labels ) {
+ double cut_len = track->from_units(cut_length);
+ double start_pos = edits->track->from_units(start);
+ edits->edl->labels->insert(start_pos, cut_len);
+ double end_pos = edits->track->from_units(end);
+ edits->edl->labels->insert(end_pos + cut_len, -cut_len);
+ }
+ if( edit_autos ) {
+ if( cut_length > 0 ) {
+ track->clear(end, end+cut_length, 0, 0, 0, 1, 0);
+ track->shift_keyframes(start, cut_length);