clip folder bug on reload, expander user folder drag/drop segv, remove libfdk src...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edl.C
index 4411bf4bd0c652d0a065bb72f85e32ffbb7648f8..21abfd7b99c95524e7d54020228b5f881b313840 100644 (file)
@@ -342,6 +342,7 @@ int EDL::save_xml(FileXML *file, const char *output_path)
 int EDL::copy_all(EDL *edl)
 {
        if( this == edl ) return 0;
+       folder_no = edl->folder_no;
        update_index(edl);
        copy_session(edl);
        copy_assets(edl);
@@ -402,7 +403,6 @@ void EDL::copy_session(EDL *edl, int session_only)
 
        if( !session_only ) {
                strcpy(this->path, edl->path);
-               awindow_folder = edl->awindow_folder;
                folders.copy_from(&edl->folders);
        }
 
@@ -410,7 +410,7 @@ void EDL::copy_session(EDL *edl, int session_only)
                session->copy(edl->session);
        }
 
-       if( !session_only ) {
+       if( session_only <= 0 ) {
                local_session->copy_from(edl->local_session);
        }
 }
@@ -1029,6 +1029,7 @@ EDL* EDL::add_clip(EDL *edl)
        EDL *new_edl = new EDL(this);
        new_edl->create_objects();
        new_edl->copy_all(edl);
+       new_edl->folder_no = AW_CLIP_FOLDER;
        clips.append(new_edl);
        return new_edl;
 }
@@ -1226,7 +1227,7 @@ const char *EDL::get_folder_name(int no)
        return !fp ? "" : fp->title;
 }
 
-int EDL::new_folder(const char *title)
+int EDL::new_folder(const char *title, int is_clips)
 {
        if( !title[0] ) return 1;
        int ret = get_folder_number(title);
@@ -1237,7 +1238,7 @@ int EDL::new_folder(const char *title)
                int no = fp->awindow_folder;
                if( no >= idx ) idx = no+1;
        }
-       folders.append(new BinFolder(idx, title));
+       folders.append(new BinFolder(idx, is_clips, title));
        return 0;
 }
 
@@ -1402,7 +1403,6 @@ int64_t EDL::get_video_frames()
                session->frame_rate);
 }
 
-
 void EDL::remove_vwindow_edls()
 {
        for( int i=0; i<total_vwindow_edls(); ++i ) {
@@ -1541,12 +1541,16 @@ void EDL::set_proxy(int new_scale, int use_scaler,
                rescale_proxy(orig_scale, new_scale);
 
 // change original assets to proxy assets
-       int awindow_folder = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
+       int folder_no = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
        for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
                const char *orig_path = orig_assets->get(i)->path;
                Indexable *proxy_idxbl = proxy_assets->get(i);
-               proxy_idxbl->awindow_folder = awindow_folder;
+               proxy_idxbl->folder_no = folder_no;
                Asset *proxy_asset = proxy_idxbl->is_asset ? assets->update((Asset *)proxy_idxbl) : 0;
+               if( proxy_asset && proxy_idxbl ) {
+                       proxy_asset->width = proxy_idxbl->get_w();
+                       proxy_asset->height = proxy_idxbl->get_h();
+               }
                EDL *proxy_edl = !proxy_idxbl->is_asset ? (EDL *)proxy_idxbl : 0;
 // replace track contents
                for( Track *track=tracks->first; track; track=track->next ) {
@@ -1595,7 +1599,7 @@ void EDL::add_proxy(int use_scaler,
 // change original assets to proxy assets
        for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
                Asset *proxy_asset = assets->update((Asset *)proxy_assets->get(i));
-               proxy_asset->awindow_folder = AW_PROXY_FOLDER;
+               proxy_asset->folder_no = AW_PROXY_FOLDER;
 // replace track contents
                for( Track *track=tracks->first; track; track=track->next ) {
                        if( track->data_type != TRACK_VIDEO ) continue;
@@ -1609,6 +1613,12 @@ void EDL::add_proxy(int use_scaler,
        }
 }
 
+Asset *EDL::get_proxy_asset()
+{
+       return folder_no == AW_PROXY_FOLDER ?
+               tracks->first->edits->first->asset : 0;
+}
+
 double EDL::get_cursor_position(int cursor_x, int pane_no)
 {
        return (double)cursor_x * local_session->zoom_sample / session->sample_rate +