{
FileXML file;
+ LocalSession *src = source->local_session;
double src_start = all ? 0 :
- source->local_session->get_selectionstart();
- double overwrite_len = all ? source->tracks->total_length() :
- source->local_session->get_selectionend() - src_start;
+ src->inpoint_valid() ? src->get_inpoint() :
+ src->outpoint_valid() ? 0 :
+ src->get_selectionstart();
+ double src_end = all ? source->tracks->total_length() :
+ src->outpoint_valid() ? src->get_outpoint() :
+ src->inpoint_valid() ? source->tracks->total_length() :
+ src->get_selectionend();
+ double overwrite_len = src_end - src_start;
double dst_start = edl->local_session->get_selectionstart();
double dst_len = edl->local_session->get_selectionend() - dst_start;
if( edl->session->frame_rate > 0 )
end += 1./edl->session->frame_rate;
}
- undo->update_undo_before();
+ undo->update_undo_before(_("silence"), this);
edl->paste_silence(start, end,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
PluginServer *server = session->drag_pluginservers->values[0];
undo->update_undo_before();
- if( server->audio )
- strcpy(edl->session->default_atransition, server->title);
- else
- strcpy(edl->session->default_vtransition, server->title);
-
edl->tracks->paste_transition(server, session->edit_highlighted);
save_backup();
undo->update_undo_after(_("transition"), LOAD_EDITS);
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->paste_transitions(start, end, track_type, title);
-
save_backup();
undo->update_undo_after(_("attach transitions"), LOAD_EDITS);
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 1);
+ gui->update_proxy_toggle();
gui->unlock_window();
cwindow->update(1, 1, 1, 1, 1);
cwindow->gui->unlock_window();
}
}
- if( calling_window_gui != gui )
- gui->unlock_window();
-
awindow->gui->async_update_assets();
cwindow->refresh_frame(CHANGE_ALL);
void MWindow::splice(EDL *source, int all)
{
FileXML file;
+ LocalSession *src = source->local_session;
undo->update_undo_before();
double source_start = all ? 0 :
- source->local_session->get_selectionstart();
+ src->inpoint_valid() ? src->get_inpoint() :
+ src->outpoint_valid() ? 0 : src->get_selectionstart();
double source_end = all ? source->tracks->total_length() :
- source->local_session->get_selectionend();
+ src->outpoint_valid() ? src->get_outpoint() :
+ src->inpoint_valid() ? source->tracks->total_length() :
+ src->get_selectionend();
source->copy(source_start, source_end, 1, &file, "", 1);
//file.dump();
double start = edl->local_session->get_selectionstart();
"clip_%02d%02d%02d-%02d%02d%02d.png",
dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
+ new_edl->awindow_folder = AW_CLIP_FOLDER;
edl->update_assets(new_edl);
int cur_x, cur_y;
gui->get_abs_cursor(cur_x, cur_y, 0);
void MWindow::to_clip(EDL *edl, const char *txt, int all)
{
FileXML file;
- double start, end;
+ LocalSession *src = edl->local_session;
gui->lock_window("MWindow::to_clip 1");
- start = all ? 0 :
- edl->local_session->get_selectionstart();
- end = all ? edl->tracks->total_length() :
- edl->local_session->get_selectionend();
-
+ double start = all ? 0 :
+ src->inpoint_valid() ? src->get_inpoint() :
+ src->outpoint_valid() ? 0 : src->get_selectionstart();
+ double end = all ? edl->tracks->total_length() :
+ src->outpoint_valid() ? src->get_outpoint() :
+ src->inpoint_valid() ? edl->tracks->total_length() :
+ src->get_selectionend();
if( EQUIV(end, start) ) {
start = 0;
end = edl->tracks->total_length();
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 1);
+ gui->update_proxy_toggle();
gui->unlock_window();
cwindow->update(1, 1, 1, 1, 1);
cwindow->gui->unlock_window();
}
}
- if( calling_window_gui != gui )
- gui->unlock_window();
-
awindow->gui->async_update_assets();
cwindow->refresh_frame(CHANGE_ALL);
}
-void MWindow::new_folder(const char *new_folder)
+void MWindow::new_folder(const char *new_folder, int is_clips)
{
undo->update_undo_before();
- edl->new_folder(new_folder);
+ if( edl->new_folder(new_folder, is_clips) ) {
+ MainError::show_error(_("create new folder failed"));
+ }
undo->update_undo_after(_("new folder"), LOAD_ALL);
awindow->gui->async_update_assets();
}
void MWindow::delete_folder(char *folder)
{
-// undo->update_undo_after(_("delete folder"), LOAD_ALL);
+ undo->update_undo_before();
+ if( edl->delete_folder(folder) < 0 ) {
+ MainError::show_error(_("delete folder failed"));
+ }
+ undo->update_undo_after(_("del folder"), LOAD_ALL);
+ awindow->gui->async_update_assets();
}
void MWindow::select_point(double position)
{
+ gui->unlock_window();
+ gui->stop_drawing();
+ cwindow->stop_playback(0);
+ gui->lock_window("MWindow::select_point");
+
edl->local_session->set_selectionstart(position);
edl->local_session->set_selectionend(position);
void MWindow::rescale_proxy(EDL *clip, int orig_scale, int new_scale)
{
- if( orig_scale == new_scale ) return;
-// project size
- float orig_w = (float)clip->session->output_w * orig_scale;
- float orig_h = (float)clip->session->output_h * orig_scale;
- if( !clip->parent_edl ) {
- clip->session->output_w = Units::round(orig_w / new_scale);
- clip->session->output_h = Units::round(orig_h / new_scale);
- }
-
-// track sizes
- for( Track *track=clip->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- orig_w = (float)track->track_w * orig_scale;
- orig_h = (float)track->track_h * orig_scale;
- track->track_w = Units::round(orig_w / new_scale);
- track->track_h = Units::round(orig_h / new_scale);
- ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])->
- set_proxy(orig_scale, new_scale);
- }
-}
-
-void MWindow::set_proxy(int use_scaler, int new_scale, int auto_scale,
- ArrayList<Indexable*> *orig_assets,
- ArrayList<Indexable*> *proxy_assets)
-{
- int orig_use_scaler = edl->session->proxy_use_scaler;
- int orig_scale = edl->session->proxy_scale;
-// rescale to full size asset in read_frame
- edl->session->proxy_use_scaler = use_scaler;
- edl->session->proxy_scale = new_scale;
- edl->session->proxy_auto_scale = auto_scale;
-
- if( use_scaler ) {
- for( int i=0; i<proxy_assets->size(); ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
- new_scale = 1;
- }
-
- if( !orig_use_scaler )
- rescale_proxy(edl, orig_scale, new_scale);
-
-// change original assets to proxy assets
- int awindow_folder = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i));
- proxy_asset->awindow_folder = awindow_folder;
-// replace track contents
- for( Track *track=edl->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- edit->asset = proxy_asset;
- }
- }
- }
- for( int j=0,m=edl->clips.size(); j<m; ++j ) {
- EDL *clip = edl->clips[j];
- int has_proxy = 0;
- for( Track *track=clip->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- has_proxy = 1;
- edit->asset = proxy_asset;
- }
- }
- }
- if( has_proxy && !orig_use_scaler )
- rescale_proxy(clip, orig_scale, new_scale);
- }
- }
+ edl->rescale_proxy(orig_scale, new_scale);
}
void MWindow::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets,
- ArrayList<Indexable*> *proxy_assets)
-{
- if( use_scaler ) {
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
- }
-
-// change original assets to proxy assets
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i));
- proxy_asset->awindow_folder = AW_PROXY_FOLDER;
-// replace track contents
- for( Track *track=edl->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- edit->asset = proxy_asset;
- }
- }
- }
- }
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+{
+ edl->add_proxy(use_scaler, orig_assets, proxy_assets);
}
void MWindow::cut_commercials()
{
+#ifdef HAVE_COMMERCIAL
undo->update_undo_before();
commercials->scan_media();
edl->optimize();
gui->update(1, 2, 1, 1, 1, 1, 0);
cwindow->update(1, 0, 0, 0, 1);
cwindow->refresh_frame(CHANGE_EDL);
+#endif
}
int MWindow::normalize_speed(EDL *old_edl, EDL *new_edl)
int MWindow::speed_after(int done)
{
int result = 0;
- if( speed_edl && done >= 0 )
- result = normalize_speed(speed_edl, edl);
- if( done ) {
- speed_edl->remove_user();
- speed_edl = 0;
+ if( speed_edl ) {
+ if( done >= 0 )
+ result = normalize_speed(speed_edl, edl);
+ if( done != 0 ) {
+ speed_edl->remove_user();
+ speed_edl = 0;
+ }
}
return result;
}