for( int i=0; i<new_assets->total; ++i ) {
Indexable *indexable = new_assets->get(i);
if( indexable->is_asset ) {
- remove_asset_from_caches((Asset*)indexable);
+ remove_from_caches(indexable);
}
EDL *new_edl = new EDL;
new_edl->create_objects();
else
// Recycle existing tracks of master EDL
if( load_mode == LOADMODE_CONCATENATE ||
- load_mode == LOADMODE_PASTE ||
- load_mode == LOADMODE_NESTED ) {
+ load_mode == LOADMODE_PASTE ) {
Track *current = first_track ? first_track : edl->tracks->first;
for( ; current; current=NEXT ) {
if( current->record ) {
// Add assets and prepare index files
for( Asset *new_asset=new_edl->assets->first;
new_asset; new_asset=new_asset->next ) {
- mainindexes->add_next_asset(0, new_asset);
+ mainindexes->add_indexable(new_asset);
}
// Capture index file status from mainindex test
edl->update_assets(new_edl);
//PRINT_TRACE
// Get starting point of insertion. Need this to paste labels.
switch( load_mode ) {
+ case LOADMODE_NOTHING:
+ continue;
case LOADMODE_REPLACE:
current_position = 0;
break;
break;
case LOADMODE_PASTE:
- case LOADMODE_NESTED:
destination_track = 0;
if( i == 0 ) {
for( int j=0; j<destination_tracks.total; ++j ) {
load_mode != LOADMODE_ASSETSONLY ) {
// Insert labels
if( edit_labels ) {
- if( load_mode == LOADMODE_PASTE || load_mode == LOADMODE_NESTED )
+ if( load_mode == LOADMODE_PASTE )
edl->labels->insert_labels(new_edl->labels,
destination_tracks.total ? paste_position[0] : 0.0,
edl_length, 1);
break;
case LOADMODE_PASTE:
- case LOADMODE_NESTED:
current_position = paste_position[destination_track];
paste_position[destination_track] += new_track->get_length();
break;
}
}
- if( load_mode == LOADMODE_PASTE ||
- load_mode == LOADMODE_NESTED )
+ if( load_mode == LOADMODE_PASTE )
current_position += edl_length;
}
time_t now; time(&now);
struct tm dtm; localtime_r(&now, &dtm);
char *cp = new_edl->local_session->clip_notes;
- int n, sz = sizeof(new_edl->local_session->clip_notes)-1;
- if( txt && *txt ) {
- n = snprintf(cp, sz, "%s", txt);
- cp += n; sz -= n;
- }
- n = snprintf(cp, sz,
+ char *ep = cp + sizeof(new_edl->local_session->clip_notes)-1;
+ if( txt && *txt )
+ cp += snprintf(cp, ep-cp, "%s", txt);
+ cp += snprintf(cp, ep-cp,
"%02d/%02d/%02d %02d:%02d:%02d, +%s\n",
dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
dtm.tm_hour, dtm.tm_min, dtm.tm_sec, duration);
- cp += n; sz -= n;
if( path && *path ) {
FileSystem fs;
char title[BCTEXTLEN];
fs.extract_name(title, path);
- n = snprintf(cp, sz, "%s", title);
- cp += n; sz -= n;
+ cp += snprintf(cp, ep-cp, "%s", title);
}
- cp[n] = 0;
sprintf(new_edl->local_session->clip_icon,
- "clip_%02d%02d%02d-%02d%02d%02d.png",
+ "clip_%02d%02d%02d-%02d%02d%02d-%d.png",
dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
- dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
+ dtm.tm_hour, dtm.tm_min, dtm.tm_sec,
+ new_edl->id);
new_edl->folder_no = AW_CLIP_FOLDER;
edl->update_assets(new_edl);
int cur_x, cur_y;
}
void MWindow::start_convert(Asset *format_asset, const char *suffix,
- float beep, int remove_originals)
+ float beep, int to_proxy, int remove_originals)
{
if( !convert_render )
convert_render = new ConvertRender(this);
- convert_render->set_format(format_asset, suffix);
+ convert_render->set_format(format_asset, suffix, to_proxy);
int found = convert_render->find_convertable_assets(edl);
if( convert_render->needed_idxbls.size() > 0 )
convert_render->start_convert(beep, remove_originals);
return result;
}
+void MWindow::collect_effects()
+{
+ FileXML file;
+ const char *file_string = "";
+ EDL *group = 0;
+ int ret = edl->collect_effects(group);
+ switch( ret ) {
+ case COLLECT_EFFECTS_RECORD:
+ eprintf(_("Selected edit track not armed."));
+ break;
+ case COLLECT_EFFECTS_MULTIPLE:
+ eprintf(_("More than one edit selected on a track."));
+ break;
+ case COLLECT_EFFECTS_MISSING:
+ eprintf(_("No effects under selected edit."));
+ break;
+ case COLLECT_EFFECTS_EMPTY:
+ eprintf(_("No edits selected."));
+ break;
+ case COLLECT_EFFECTS_MASTER:
+ eprintf(_("Shared effect added without master."));
+ break;
+ case 0:
+ group->save_xml(&file, "");
+ file_string = file.string();
+ group->remove_user();
+ }
+ long file_length = strlen(file_string);
+ gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
+ gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
+}
+
+void MWindow::paste_effects()
+{
+ char *string = 0;
+ int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
+ if( len ) {
+ string = new char[len];
+ gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
+ }
+ if( !string || !string[0] ) {
+ eprintf(_("Error clipboard buffer empty."));
+ return;
+ }
+ FileXML file;
+ file.read_from_string(string);
+ EDL *group = new EDL();
+ group->create_objects();
+ if( !group->load_xml(&file, LOAD_ALL) ) {
+ undo_before();
+ int ret = edl->insert_effects(group);
+ switch( ret ) {
+ case INSERT_EFFECTS_RECORD:
+ eprintf(_("Selected edit track not armed."));
+ break;
+ case INSERT_EFFECTS_TYPE:
+ eprintf(_("Track type mismatched."));
+ break;
+ case INSERT_EFFECTS_MULTIPLE:
+ eprintf(_("More than one edit selected on a track."));
+ break;
+ case INSERT_EFFECTS_MISSING:
+ eprintf(_("Too few target edits to add group effects."));
+ break;
+ case INSERT_EFFECTS_EXTRA:
+ eprintf(_("Too many target edits to add group effects."));
+ break;
+ case INSERT_EFFECTS_MASTER:
+ eprintf(_("Shared effect added without master."));
+ break;
+ case 0:
+ break;
+ }
+ save_backup();
+ undo_after(_("paste effects"), LOAD_ALL);
+ restart_brender();
+ cwindow->refresh_frame(CHANGE_EDL);
+ update_plugin_guis();
+ gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
+ }
+ else
+ eprintf(_("Error loading clip from clipboard buffer."));
+ delete [] string;
+ group->remove_user();
+}
+