add binfolder path relative filters, fix gbrp color model, vwdw timebar tweaks, title...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edit.C
index 3658922df6d816a62cc1486e396072d7900649fd..198a0fdfc0f62e435cb7cf2347f1132858c1f82e 100644 (file)
@@ -32,7 +32,7 @@
 #include "localsession.h"
 #include "plugin.h"
 #include "mainsession.h"
-#include "nestededls.h"
+#include "strack.h"
 #include "trackcanvas.h"
 #include "tracks.h"
 #include "transition.h"
@@ -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");
 
@@ -229,17 +233,21 @@ void Edit::detach_transition()
 
 int Edit::silence()
 {
-       return asset || nested_edl ? 0 : 1;
+       return (track->data_type != TRACK_SUBTITLE ?
+               asset || nested_edl :
+               *((SEdit *)this)->get_text()) ? 0 : 1;
 }
 
 
 void Edit::copy_from(Edit *edit)
 {
-       this->nested_edl = edl->nested_edls->get_copy(edit->nested_edl);
+       this->nested_edl = edl->nested_edls.get_nested(edit->nested_edl);
        this->asset = edl->assets->update(edit->asset);
        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)
@@ -315,6 +323,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;
@@ -372,8 +382,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;
 }
 
@@ -381,6 +391,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;
@@ -713,13 +725,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
@@ -807,3 +823,23 @@ int Edit::select_handle(float view_start, float zoom_units, int cursor_x, int cu
        return 0;
 }
 
+void Edit::get_title(char *title)
+{
+       if( user_title[0] ) {
+               strcpy(title, user_title);
+               return;
+       }
+       Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl;
+       if( !idxbl ) {
+               title[0] = 0;
+               return;
+       }
+       FileSystem fs;
+       fs.extract_name(title, idxbl->path);
+       if( asset || track->data_type == TRACK_AUDIO ) {
+               char number[BCSTRLEN];
+               sprintf(number, " #%d", channel + 1);
+               strcat(title, number);
+       }
+}
+