fix for title color in old edl xml, fix default edit popup color value
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / edit.C
index 347e94086daa8a7a3bae779873c7b5ecbdf065a4..fc36b187f6cca511f92b205ef4cf81709b6e58e5 100644 (file)
@@ -86,7 +86,8 @@ void Edit::reset()
        is_selected = 0;
        hard_left = 0;
        hard_right = 0;
-       color = -1;
+       color = 0;
+       group_id = 0;
 }
 
 Indexable* Edit::get_source()
@@ -143,6 +144,7 @@ int Edit::copy(int64_t start,
                        file->tag.set_property("HARD_LEFT", hard_left);
                        file->tag.set_property("HARD_RIGHT", hard_right);
                        file->tag.set_property("COLOR", color);
+                       file->tag.set_property("GROUP_ID", group_id);
                        if(user_title[0]) file->tag.set_property("USER_TITLE", user_title);
 //printf("Edit::copy 5\n");
 
@@ -240,7 +242,15 @@ int Edit::silence()
                asset || nested_edl :
                *((SEdit *)this)->get_text()) ? 0 : 1;
 }
-
+void Edit::mute()
+{
+       if( track->data_type != TRACK_SUBTITLE ) {
+               asset = 0;
+               nested_edl = 0;
+       }
+       else
+               *((SEdit *)this)->get_text() = 0;
+}
 
 void Edit::copy_from(Edit *edit)
 {
@@ -252,6 +262,7 @@ void Edit::copy_from(Edit *edit)
        this->hard_left = edit->hard_left;
        this->hard_right = edit->hard_right;
        this->color = edit->color;
+       this->group_id = edit->group_id;
        strcpy (this->user_title, edit->user_title);
 
        if(edit->transition)
@@ -378,7 +389,7 @@ int Edit::dump(FILE *fp)
                asset,
                asset ? asset->path : "");
        fflush(fp);
-       fprintf(fp,"      channel %d, color %08x\n", channel, color);
+       fprintf(fp,"      channel %d, color %08x, group_id %d\n", channel, color, group_id);
        if(transition)
        {
                fprintf(fp,"      TRANSITION %p\n", transition);
@@ -395,7 +406,8 @@ int Edit::load_properties(FileXML *file, int64_t &startproject)
        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);
-       color = file->tag.get_property("COLOR", (int64_t)-1);
+       color = file->tag.get_property("COLOR", 0);
+       group_id = file->tag.get_property("GROUP_ID", group_id);
        user_title[0] = 0;
        file->tag.get_property("USER_TITLE", user_title);
        this->startproject = startproject;
@@ -817,21 +829,3 @@ void Edit::get_title(char *title)
        }
 }
 
-int Edit::get_hash_color()
-{
-       Indexable *idxbl = asset ? (Indexable*)asset : (Indexable*)nested_edl;
-       if( !idxbl ) return -1;
-       int v = 0;
-       for( uint8_t *bp=(uint8_t*)idxbl->path; *bp; ++bp ) v += *bp;
-       int color = 0x303030;
-       if( v & 0x01 ) color ^= 0x000040;
-       if( v & 0x02 ) color ^= 0x004000;
-       if( v & 0x04 ) color ^= 0x400000;
-       if( v & 0x08 ) color ^= 0x080000;
-       if( v & 0x10 ) color ^= 0x000800;
-       if( v & 0x20 ) color ^= 0x000008;
-       if( v & 0x40 ) color ^= 0x202020;
-       if( v & 0x80 ) color ^= 0x101010;
-       return color;
-}
-