sams last ladspa icons, libopus/vp9, mixer fixer, plugin resets, fmt frmsz, shm fixes
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edit.C
index 0ede9b9ef2a34acfc7dc22f38bcb52771b469055..4c257cbe964164a274187b3ab11f8d6515048d9f 100644 (file)
@@ -83,6 +83,8 @@ void Edit::reset()
        user_title[0] = 0;
        nested_edl = 0;
        is_plugin = 0;
+       hard_left = 0;
+       hard_right = 0;
 }
 
 Indexable* Edit::get_source()
@@ -136,6 +138,8 @@ int Edit::copy(int64_t start,
                        file->tag.set_property("STARTSOURCE", startsource_in_selection);
                        file->tag.set_property("CHANNEL", (int64_t)channel);
                        file->tag.set_property("LENGTH", length_in_selection);
+                       file->tag.set_property("HARD_LEFT", hard_left);
+                       file->tag.set_property("HARD_RIGHT", hard_right);
                        if(user_title[0]) file->tag.set_property("USER_TITLE", user_title);
 //printf("Edit::copy 5\n");
 
@@ -150,6 +154,9 @@ int Edit::copy(int64_t start,
                                file->tag.set_title("NESTED_EDL");
                                file->tag.set_property("SRC", nested_edl->path);
                                file->append_tag();
+                               file->tag.set_title("/NESTED_EDL");
+                               file->append_tag();
+                               file->append_newline();
                        }
 
                        if(asset)
@@ -213,10 +220,8 @@ int64_t Edit::get_source_end(int64_t default_)
 void Edit::insert_transition(char *title)
 {
 //printf("Edit::insert_transition this=%p title=%p title=%s\n", this, title, title);
-       detach_transition();
-       transition = new Transition(edl,
-               this,
-               title,
+       delete transition;
+       transition = new Transition(edl, this, title,
                track->to_units(edl->session->default_transition_length, 1));
 }
 
@@ -228,10 +233,7 @@ void Edit::detach_transition()
 
 int Edit::silence()
 {
-       if(asset || nested_edl)
-               return 0;
-       else
-               return 1;
+       return asset || nested_edl ? 0 : 1;
 }
 
 
@@ -242,6 +244,8 @@ void Edit::copy_from(Edit *edit)
        this->startsource = edit->startsource;
        this->startproject = edit->startproject;
        this->length = edit->length;
+       this->hard_left = edit->hard_left;
+       this->hard_right = edit->hard_right;
        strcpy (this->user_title, edit->user_title);
 
        if(edit->transition)
@@ -284,7 +288,7 @@ void Edit::equivalent_output(Edit *edit, int64_t *result)
                        !transition->identical(edit->transition)) ||
 // Asset changed
                (asset && edit->asset &&
-                       !asset->equivalent(*edit->asset, 1, 1)) ||
+                       !asset->equivalent(*edit->asset, 1, 1, edl)) ||
 // Nested EDL changed
                (nested_edl && edit->nested_edl &&
                        strcmp(nested_edl->path, edit->nested_edl->path))
@@ -317,6 +321,8 @@ int Edit::identical(Edit &edit)
                this->startsource == edit.startsource &&
                this->startproject == edit.startproject &&
                this->length == edit.length &&
+               this->hard_left == edit.hard_left &&
+               this->hard_right == edit.hard_right &&
                this->transition == edit.transition &&
                this->channel == edit.channel);
        return result;
@@ -374,8 +380,8 @@ int Edit::dump(FILE *fp)
                fprintf(fp,"      TRANSITION %p\n", transition);
                transition->dump(fp);
        }
-       fprintf(fp,"      startsource %jd startproject %jd length %jd\n",
-               startsource, startproject, length); fflush(fp);
+       fprintf(fp,"      startsource %jd startproject %jd hard lt/rt %d/%d length %jd\n",
+               startsource, startproject, hard_left, hard_right, length); fflush(fp);
        return 0;
 }
 
@@ -383,6 +389,8 @@ int Edit::load_properties(FileXML *file, int64_t &startproject)
 {
        startsource = file->tag.get_property("STARTSOURCE", (int64_t)0);
        length = file->tag.get_property("LENGTH", (int64_t)0);
+       hard_left = file->tag.get_property("HARD_LEFT", (int64_t)0);
+       hard_right = file->tag.get_property("HARD_RIGHT", (int64_t)0);
        user_title[0] = 0;
        file->tag.get_property("USER_TITLE", user_title);
        this->startproject = startproject;
@@ -692,11 +700,11 @@ int Edit::shift_end_out(int edit_mode,
 
 // Effects are shifted in length extension
                if(edit_plugins)
-                       edits->shift_effects_recursive(oldposition /* startproject */, 
+                       edits->shift_effects_recursive(oldposition /* startproject */,
                                cut_length,
                                edit_autos);
                if(edit_autos)
-                       edits->shift_keyframes_recursive(oldposition /* startproject */, 
+                       edits->shift_keyframes_recursive(oldposition /* startproject */,
                                cut_length);
 
                for(Edit* current_edit = next; current_edit; current_edit = current_edit->next)
@@ -715,13 +723,17 @@ int Edit::shift_end_out(int edit_mode,
                                next->startproject += cut_length;
                                next->startsource += cut_length;
                                next->length -= cut_length;
-//printf("Edit::shift_end_out 2 %d\n", cut_length);
+//printf("Edit::shift_end_out %d cut_length=%d\n", __LINE__, cut_length);
                        }
                        else
                        {
+//printf("Edit::shift_end_out %d cut_length=%d next->length=%d\n", __LINE__, cut_length, next->length);
                                cut_length = next->length;
+                               next->startproject += next->length;
+                               next->startsource += next->length;
                                next->length = 0;
                                length += cut_length;
+//track->dump();
                        }
                }
                else
@@ -800,7 +812,7 @@ int Edit::select_handle(float view_start, float zoom_units, int cursor_x, int cu
        pixel2 = right;
        pixel1 = pixel2 - 10;
 
-// test right edit     
+// test right edit
        if(cursor_x >= pixel1 && cursor_x <= pixel2)
        {
                selection = right_unit;