add edit clear submenu/clear hard_edges, fix tessy gl segv, mask toolgui layout,...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / tracksedit.C
index 5bda1f02f146ee862290a2c397ab59dcace39ec1..183f35f7b90f5e0dee58cc25918f914c80e6ef47 100644 (file)
@@ -120,6 +120,24 @@ void Tracks::clear_transitions(double start, double end)
        }
 }
 
+int Tracks::clear_hard_edges(double start, double end)
+{
+       for( Track *track=first; track; track=track->next ) {
+               if( !track->record ) continue;
+               int64_t start_units = track->to_units(start, 0);
+               int64_t end_units = track->to_units(end, 0);
+
+               for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+                       if( edit->startproject < start_units ) continue;
+                       if( edit->startproject >= end_units ) continue;
+                       edit->hard_left = 0;
+                       if( !edit->previous ) continue;
+                       edit->previous->hard_right = 0;
+               }
+       }
+       return 0;
+}
+
 void Tracks::shuffle_edits(double start, double end)
 {
 // This doesn't affect automation or effects
@@ -851,24 +869,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;
                }
        }
 
@@ -877,24 +886,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;
                }
        }
 
@@ -902,7 +902,6 @@ int Tracks::move_tracks_down()
 }
 
 
-
 void Tracks::paste_audio_transition(PluginServer *server)
 {
        for(Track *current = first; current; current = NEXT)