- int64_t cut_length = oldposition - newposition;
-
-
- if(asset || nested_edl)
- {
- int64_t end_source = get_source_end(1);
-
-//printf("Edit::shift_start_out 1 %jd %jd\n", startsource, cut_length);
- if(end_source > 0 && startsource < cut_length)
- {
- cut_length = startsource;
+ int64_t cut_length = newposition - oldposition;
+ int rest_moved = edit_mode == MOVE_RIPPLE || edit_mode == MOVE_EDGE ? 1 : 0;
+ if( cut_length > length )
+ cut_length = length;
+ else if( cut_length < -length )
+ cut_length = -length;
+
+ int64_t start = startproject, end = start + length;
+ Edit *prev = this->previous, *next = this->next;
+ int edits_moved = 0;
+
+ switch( edit_mode ) {
+ case MOVE_RIPPLE:
+ edits_moved = 1;
+ startsource += cut_length;
+ cut_length = -cut_length;
+ length += cut_length;
+ for( Edit *edit=next; edit; edit=edit->next )
+ edit->startproject += cut_length;
+ break;
+ case MOVE_ROLL:
+ if( prev && prev->length + cut_length < 0 )
+ cut_length = -prev->length;
+ if( prev ) prev->trim(cut_length);
+ startproject += cut_length;
+ startsource += cut_length;
+ length -= cut_length;
+ break;
+ case MOVE_SLIP:
+ edits_moved = 1;
+ startsource -= cut_length;
+ break;
+ case MOVE_SLIDE:
+ edits_moved = 1;
+ if( prev && prev->length + cut_length < 0 )
+ cut_length = -prev->length;
+ if( next && next->length - cut_length < 0 )
+ cut_length = next->length;
+ if( prev ) prev->trim(cut_length);
+ startproject += cut_length;
+ if( next ) {
+ next->startproject += cut_length;
+ next->startsource += cut_length;
+ next->trim(-cut_length);