upgrade libvpx+lv2, fix dbl tap play bug, add multi nest/unnest clips, add del top...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / tracksedit.C
index afe491f39aec9176c1581358c04fe803f385e144..9cc095bff2de024210a239742aff9ab23cbb936d 100644 (file)
@@ -214,28 +214,13 @@ void Tracks::set_edit_length(double start, double end, double length)
 // Go in using the edit handle interface
                                        int64_t starting_length = current_edit->length;
 
-                                       if(length_units < current_edit->length)
-                                       {
-                                               current_edit->shift_end_in(MOVE_ALL_EDITS,
-                                                       current_edit->startproject + length_units,
-                                                       current_edit->startproject + current_edit->length,
-                                                       1,
-                                                       edl->session->labels_follow_edits,
-                                                       edl->session->plugins_follow_edits,
-                                                       edl->session->autos_follow_edits,
-                                                       0);
-                                       }
-                                       else
-                                       {
-                                               current_edit->shift_end_out(MOVE_ALL_EDITS,
-                                                       current_edit->startproject + length_units,
-                                                       current_edit->startproject + current_edit->length,
-                                                       1,
-                                                       edl->session->labels_follow_edits,
-                                                       edl->session->plugins_follow_edits,
-                                                       edl->session->autos_follow_edits,
-                                                       0);
-                                       }
+                                       current_edit->shift_end(MOVE_RIPPLE,
+                                               current_edit->startproject + length_units,
+                                               current_edit->startproject + current_edit->length,
+                                               0,
+                                               edl->session->autos_follow_edits,
+                                               edl->session->plugins_follow_edits,
+                                               0);
 
                                        int64_t ending_length = current_edit->length;
 
@@ -248,8 +233,6 @@ void Tracks::set_edit_length(double start, double end, double length)
                                                 edl->labels->modify_handles(
                                                        current_track->from_units(current_edit->startproject + starting_length),
                                                        current_track->from_units(current_edit->startproject + ending_length),
-                                                       1,
-                                                       MOVE_ALL_EDITS,
                                                        1);
                                        }
 
@@ -298,42 +281,23 @@ void Tracks::set_edit_length(double start, double end, double length)
 // Go in using the edit handle interface
                                        int64_t starting_length = current_edit->length;
 
-                                       if(length_units < current_edit->length)
-                                       {
-                                               current_edit->shift_end_in(MOVE_ALL_EDITS,
-                                                       current_edit->startproject + length_units,
-                                                       current_edit->startproject + current_edit->length,
-                                                       1,
-                                                       edl->session->labels_follow_edits,
-                                                       edl->session->plugins_follow_edits,
-                                                       edl->session->autos_follow_edits,
-                                                       0);
-                                       }
-                                       else
-                                       {
-                                               current_edit->shift_end_out(MOVE_ALL_EDITS,
-                                                       current_edit->startproject + length_units,
-                                                       current_edit->startproject + current_edit->length,
-                                                       1,
-                                                       edl->session->labels_follow_edits,
-                                                       edl->session->plugins_follow_edits,
-                                                       edl->session->autos_follow_edits,
-                                                       0);
-                                       }
+                                       current_edit->shift_end(MOVE_RIPPLE,
+                                               current_edit->startproject + length_units,
+                                               current_edit->startproject + current_edit->length,
+                                               0,
+                                               edl->session->autos_follow_edits,
+                                               edl->session->plugins_follow_edits,
+                                               0);
 
                                        int64_t ending_length = current_edit->length;
 
-                                       if(edl->session->labels_follow_edits && first_track)
-                                       {
-// printf("Tracks::set_edit_length %d %f %f\n",
-// __LINE__,
+                                       if(edl->session->labels_follow_edits && first_track) {
+// printf("Tracks::set_edit_length %d %f %f\n", __LINE__,
 // current_track->from_units(current_edit->startproject + starting_length),
 // current_track->from_units(current_edit->startproject + ending_length));
                                                 edl->labels->modify_handles(
                                                        current_track->from_units(current_edit->startproject + starting_length),
                                                        current_track->from_units(current_edit->startproject + ending_length),
-                                                       1,
-                                                       MOVE_ALL_EDITS,
                                                        1);
                                        }
 
@@ -648,7 +612,7 @@ void Tracks::move_edits(ArrayList<Edit*> *in_edits, Track *track, double positio
                }
 
                FileXML track_xml;
-               source_track->copy(source_start, source_end, &track_xml, "");
+               source_track->copy(COPY_TRACKS, source_start, source_end, &track_xml, "");
                if( !track_xml.read_tag() )
                        clip_track->load(&track_xml, 0, LOAD_ALL);
 
@@ -836,27 +800,16 @@ void Tracks::change_plugins(SharedLocation &old_location, SharedLocation &new_lo
 // =========================================== EDL editing
 
 
-int Tracks::copy(double start,
-       double end,
-       int all,
-       FileXML *file,
-       const char *output_path)
+int Tracks::copy(int copy_flags, double start, double end,
+               FileXML *file, const char *output_path)
 {
-// nothing selected
-       if(start == end && !all) return 1;
-
-       Track* current;
-
-       for(current = first;
-               current;
-               current = NEXT)
-       {
-               if(current->record || all)
-               {
-                       current->copy(start, end, file,output_path);
-               }
+       int all = (copy_flags & COPY_ALL) ? 1 : 0;
+// if nothing selected
+       if( start == end && !all ) return 1;
+       for( Track *track=first; track; track=track->next ) {
+               if( track->record || all )
+                       track->copy(copy_flags, start, end, file, output_path);
        }
-
        return 0;
 }
 
@@ -898,24 +851,15 @@ int Tracks::move_track_down(Track *track)
 
 int Tracks::move_tracks_up()
 {
-       Track *track, *next_track;
        int result = 0;
-
-       for(track = first;
-               track;
-               track = next_track)
-       {
-               next_track = track->next;
-
-               if(track->record)
-               {
-                       if(track->previous)
-                       {
-                               change_modules(number_of(track->previous), number_of(track), 1);
-
-                               swap(track->previous, track);
-                               result = 1;
-                       }
+       Track *next = first;
+       while( next ) {
+               Track *track = next;  next = track->next;
+               if( !track->record ) continue;
+               if( track->previous ) {
+                       change_modules(number_of(track->previous), number_of(track), 1);
+                       swap(track->previous, track);
+                       result = 1;
                }
        }
 
@@ -924,24 +868,15 @@ int Tracks::move_tracks_up()
 
 int Tracks::move_tracks_down()
 {
-       Track *track, *previous_track;
        int result = 0;
-
-       for(track = last;
-               track;
-               track = previous_track)
-       {
-               previous_track = track->previous;
-
-               if(track->record)
-               {
-                       if(track->next)
-                       {
-                               change_modules(number_of(track), number_of(track->next), 1);
-
-                               swap(track, track->next);
-                               result = 1;
-                       }
+       Track *prev = last;
+       while( prev ) {
+               Track *track = prev;  prev = track->previous;
+               if( !track->record ) continue;
+               if( track->next ) {
+                       change_modules(number_of(track), number_of(track->next), 1);
+                       swap(track, track->next);
+                       result = 1;
                }
        }
 
@@ -949,7 +884,6 @@ int Tracks::move_tracks_down()
 }
 
 
-
 void Tracks::paste_audio_transition(PluginServer *server)
 {
        for(Track *current = first; current; current = NEXT)
@@ -1182,6 +1116,8 @@ int Tracks::modify_edithandles(double &oldposition, double &newposition,
                track->modify_edithandles(oldposition, newposition,
                        currentend, handle_mode, edit_labels,
                        edit_plugins, edit_autos, group_id);
+// labels follow first armed track
+               edit_labels = 0;
        }
        return 0;
 }