awindowgui / mwindowedit / label rework
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edl.C
index 41ee55b4fddd716757ef560dc68fc29cc13f61bc..5d9ff496238e1f15727fe154c333bf04ae015786 100644 (file)
@@ -38,6 +38,7 @@
 #include "interlacemodes.h"
 #include "labels.h"
 #include "localsession.h"
+#include "maskautos.h"
 #include "mutex.h"
 #include "nestededls.h"
 #include "panauto.h"
@@ -608,14 +609,9 @@ int EDL::copy(double start,
 
 // Media
 // Don't replicate all assets for every clip.
-// The assets for the clips are probably in the mane EDL.
-               if(!is_clip)
-                       copy_assets(start,
-                               end,
-                               file,
-                               all,
-                               output_path);
-
+// The assets for the clips are probably in the main EDL.
+               if( !is_clip )
+                       copy_assets(start, end, file, all, output_path);
 // Clips
 // Don't want this if using clipboard
                if(all)
@@ -648,10 +644,9 @@ int EDL::copy(double start,
 //printf("EDL::copy 2\n");
 
 // terminate file
-       if(is_clip)
+       if( is_clip )
                file->tag.set_title("/CLIP_EDL");
-       else
-       if(is_vwindow)
+       else if( is_vwindow )
                file->tag.set_title("/VWINDOW_EDL");
        else
                file->tag.set_title("/EDL");
@@ -669,6 +664,26 @@ int EDL::copy(double start,
        return 0;
 }
 
+void EDL::retrack()
+{
+       int min_w = session->output_w, min_h = session->output_h;
+       for( Track *track=tracks->first; track!=0; track=track->next ) {
+               if( track->data_type != TRACK_VIDEO ) continue;
+               int w = min_w, h = min_h;
+               for( Edit *current=track->edits->first; current!=0; current=NEXT ) {
+                       Indexable* indexable = current->get_source();
+                       if( !indexable ) continue;
+                       int edit_w = indexable->get_w(), edit_h = indexable->get_h();
+                       if( w < edit_w ) w = edit_w;
+                       if( h < edit_h ) h = edit_h;
+               }
+               if( track->track_w == w && track->track_h == h ) continue;
+               ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->
+                       translate_masks( (w - track->track_w) / 2, (h - track->track_h) / 2);
+               track->track_w = w;  track->track_h = h;
+       }
+}
+
 void EDL::rechannel()
 {
        for(Track *current = tracks->first; current; current = NEXT)
@@ -1001,19 +1016,10 @@ int64_t EDL::get_tracks_width()
 // Get the total output size scaled to aspect ratio
 void EDL::calculate_conformed_dimensions(int single_channel, float &w, float &h)
 {
-       w = session->output_w;
-       h = session->output_h;
-
        if((float)session->output_w / session->output_h > get_aspect_ratio())
-       {
-               h = (float)h *
-                       (session->output_w / get_aspect_ratio() / session->output_h);
-       }
+               h = (w = session->output_w) / get_aspect_ratio();
        else
-       {
-               w = (float)w *
-                       (h * get_aspect_ratio() / session->output_w);
-       }
+               w = (h = session->output_h) * get_aspect_ratio();
 }
 
 float EDL::get_aspect_ratio()