3 * Copyright (C) 2016-2020 William Morrow
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 #include "bcsignals.h"
25 #include "indexstate.h"
37 void ClipEDLs::clear()
39 for( int i=0; i<size(); ++i ) get(i)->remove_user();
43 void ClipEDLs::add_clip(EDL *edl)
45 edl->folder_no = AW_CLIP_FOLDER;
50 void ClipEDLs::remove_clip(EDL *clip)
55 while( --n >= 0 ) clip->remove_user();
59 EDL* ClipEDLs::get_nested(EDL *src)
62 for( int i=0; i<size(); ++i ) {
64 if( src == dst || src->id == dst->id ) return dst;
66 for( int i=0; i<size(); ++i ) {
68 if( !strcmp(dst->path, src->path) ) return dst;
72 dst->create_objects();
78 EDL* ClipEDLs::load(char *path)
80 for( int i=0; i<size(); ++i ) {
82 if( !strcmp(dst->path, path) ) return dst;
86 dst->create_objects();
89 xml_file.read_from_file(path);
90 dst->load_xml(&xml_file, LOAD_ALL);
92 // Override path EDL was saved to with the path it was loaded from.
98 void ClipEDLs::copy_nested(ClipEDLs &nested)
101 for( int i=0; i<nested.size(); ++i ) {
102 EDL *new_edl = new EDL;
103 new_edl->create_objects();
104 new_edl->copy_all(nested[i]);
109 void ClipEDLs::update_index(EDL *clip_edl)
111 for( int i=0; i<size(); ++i ) {
112 EDL *current = get(i);
113 if( !strcmp(current->path, clip_edl->path) ) {
114 current->update_index(clip_edl);