X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowedit.C;h=7a6cbeb4eb2aa981bd7e197b8b2388bff4e5db48;hp=f74bfa0c4972db969cb617c9115d184b7069b548;hb=1cd1ac7ef2a8f250bb4fa35af4d925bae98534ae;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index f74bfa0c..7a6cbeb4 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -41,6 +41,7 @@ #include "gwindow.h" #include "gwindowgui.h" #include "keyframe.h" +#include "keyframes.h" #include "language.h" #include "labels.h" #include "levelwindow.h" @@ -88,7 +89,7 @@ void MWindow::add_audio_track_entry(int above, Track *dst) undo->update_undo_after(_("add track"), LOAD_ALL); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); gui->activate_timeline(); // gui->get_scrollbars(0); @@ -108,7 +109,7 @@ void MWindow::add_video_track_entry(Track *dst) restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); gui->activate_timeline(); // gui->get_scrollbars(0); // gui->canvas->draw(); @@ -128,7 +129,7 @@ void MWindow::add_subttl_track_entry(Track *dst) restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); gui->activate_timeline(); // gui->get_scrollbars(0); // gui->canvas->draw(); @@ -230,7 +231,7 @@ void MWindow::asset_to_all() undo->update_undo_after(_("asset to all"), LOAD_ALL); restart_brender(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); sync_parameters(CHANGE_ALL); } } @@ -290,7 +291,7 @@ void MWindow::asset_to_rate() undo->update_undo_after(_("asset to rate"), LOAD_ALL); restart_brender(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); sync_parameters(CHANGE_ALL); } } @@ -307,7 +308,7 @@ void MWindow::clear_entry() restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); cwindow->refresh_frame(CHANGE_EDL); } @@ -330,7 +331,7 @@ void MWindow::update_gui(int changed_edl) restart_brender(); update_plugin_guis(); if( changed_edl ) { - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); cwindow->refresh_frame(CHANGE_EDL); } @@ -415,7 +416,7 @@ void MWindow::concatenate_tracks() undo->update_undo_after(_("concatenate tracks"), LOAD_EDITS); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); cwindow->refresh_frame(CHANGE_EDL); } @@ -535,7 +536,7 @@ void MWindow::blade(double position) undo->update_undo_after(_("blade"), LOAD_EDITS | LOAD_TIMEBAR); restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); awindow->gui->async_update_assets(); cwindow->refresh_frame(CHANGE_EDL); @@ -559,7 +560,7 @@ void MWindow::cut(double start, double end, double new_position) } restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); awindow->gui->async_update_assets(); cwindow->refresh_frame(CHANGE_EDL); @@ -650,7 +651,7 @@ void MWindow::delete_tracks() restart_brender(); update_plugin_states(); - gui->update(1, 1, 1, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 1, 0, 1, 0, 0); cwindow->refresh_frame(CHANGE_EDL); } @@ -663,7 +664,7 @@ void MWindow::delete_track(Track *track) restart_brender(); update_plugin_states(); - gui->update(1, 1, 1, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 1, 0, 1, 0, 0); cwindow->refresh_frame(CHANGE_EDL); save_backup(); } @@ -672,7 +673,7 @@ void MWindow::delete_track(Track *track) // Insert data from clipboard void MWindow::insert(double position, FileXML *file, int edit_labels, int edit_plugins, int edit_autos, - EDL *parent_edl) + EDL *parent_edl, Track *first_track, int overwrite) { // For clipboard pasting make the new edl use a separate session // from the master EDL. Then it can be resampled to the master rates. @@ -699,8 +700,8 @@ void MWindow::insert(double position, FileXML *file, - paste_edls(&new_edls, LOADMODE_PASTE, 0, position, - edit_labels, edit_plugins, edit_autos, 0); // overwrite + paste_edls(&new_edls, LOADMODE_PASTE, first_track, position, + edit_labels, edit_plugins, edit_autos, overwrite); // if( vwindow->edl ) // printf("MWindow::insert 5 %f %f\n", // vwindow->edl->local_session->in_point, @@ -758,7 +759,7 @@ void MWindow::insert_effects_cwindow(Track *dest_track) undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES); restart_brender(); sync_parameters(CHANGE_EDL); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); } void MWindow::insert_effect(char *title, @@ -884,7 +885,7 @@ void MWindow::finish_modify_handles() restart_brender(); sync_parameters(CHANGE_EDL); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); // label list can be modified awindow->gui->async_update_assets(); cwindow->update(1, 0, 0, 0, 1); @@ -903,6 +904,230 @@ void MWindow::match_output_size(Track *track) } +EDL *MWindow::selected_edits_to_clip(int packed, + double *start_position, Track **start_track, + int edit_labels, int edit_autos, int edit_plugins) +{ + double start = DBL_MAX, end = DBL_MIN; + Track *first_track=0, *last_track = 0; + for( Track *track=edl->tracks->first; track; track=track->next ) { + if( !track->record ) continue; + int empty = 1; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + if( !edit->is_selected || edit->silence() ) continue; + double edit_pos = track->from_units(edit->startproject); + if( start > edit_pos ) start = edit_pos; + if( end < (edit_pos+=edit->length) ) end = edit_pos; + empty = 0; + } + if( empty ) continue; + if( !first_track ) first_track = track; + last_track = track; + } + if( start_position ) *start_position = start; + if( start_track ) *start_track = first_track; + if( !first_track ) return 0; + EDL *new_edl = new EDL(); + new_edl->create_objects(); + new_edl->copy_session(edl); + const char *text = _("new_edl edit"); + new_edl->set_path(text); + strcpy(new_edl->local_session->clip_title, text); + strcpy(new_edl->local_session->clip_notes, text); + new_edl->session->video_tracks = 0; + new_edl->session->audio_tracks = 0; + for( Track *track=edl->tracks->first; track; track=track->next ) { + if( !track->record ) continue; + if( first_track ) { + if( first_track != track ) continue; + first_track = 0; + } + Track *new_track = 0; + if( !packed ) + new_track = new_edl->add_new_track(track->data_type); + int64_t start_pos = track->to_units(start, 0); + int64_t end_pos = track->to_units(end, 0); + int64_t startproject = 0; + Edit *edit = track->edits->first; + for( ; edit; edit=edit->next ) { + if( !edit->is_selected || edit->silence() ) continue; + if( edit->startproject < start_pos ) continue; + if( edit->startproject >= end_pos ) break; + int64_t edit_start_pos = edit->startproject; + int64_t edit_end_pos = edit->startproject + edit->length; + if( !new_track ) + new_track = new_edl->add_new_track(track->data_type); + int64_t edit_pos = edit_start_pos - start_pos; + if( !packed && edit_pos > startproject ) { + Edit *silence = new Edit(new_edl, new_track); + silence->startproject = startproject; + silence->length = edit_pos - startproject; + new_track->edits->append(silence); + startproject = edit_pos; + } + int64_t clip_start_pos = startproject; + Edit *clip_edit = new Edit(new_edl, new_track); + clip_edit->copy_from(edit); + clip_edit->startproject = startproject; + startproject += clip_edit->length; + new_track->edits->append(clip_edit); + if( edit_labels ) { + double edit_start = track->from_units(edit_start_pos); + double edit_end = track->from_units(edit_end_pos); + double clip_start = new_track->from_units(clip_start_pos); + Label *label = edl->labels->first; + for( ; label; label=label->next ) { + if( label->position < edit_start ) continue; + if( label->position >= edit_end ) break; + double clip_position = label->position - edit_start + clip_start; + Label *clip_label = new_edl->labels->first; + while( clip_label && clip_label->positionnext; + if( clip_label && clip_label->position == clip_position ) continue; + Label *new_label = new Label(new_edl, + new_edl->labels, clip_position, label->textstr); + new_edl->labels->insert_before(clip_label, new_label); + } + } + if( edit_autos ) { + Automation *automation = track->automation; + Automation *new_automation = new_track->automation; + for( int i=0; iautos[i]; + if( !autos ) continue; + Autos *new_autos = new_automation->autos[i]; + new_autos->default_auto->copy_from(autos->default_auto); + Auto *aut0 = autos->first; + for( ; aut0; aut0=aut0->next ) { + if( aut0->position < edit_start_pos ) continue; + if( aut0->position >= edit_end_pos ) break; + Auto *new_auto = new_autos->new_auto(); + new_auto->copy_from(aut0); + int64_t clip_position = aut0->position - edit_start_pos + clip_start_pos; + new_auto->position = clip_position; + new_autos->append(new_auto); + } + } + } + if( edit_plugins ) { + while( new_track->plugin_set.size() < track->plugin_set.size() ) + new_track->plugin_set.append(0); + for( int i=0; iplugin_set.total; ++i ) { + PluginSet *plugin_set = track->plugin_set[i]; + if( !plugin_set ) continue; + PluginSet *new_plugin_set = new_track->plugin_set[i]; + if( !new_plugin_set ) { + new_plugin_set = new PluginSet(new_edl, new_track); + new_track->plugin_set[i] = new_plugin_set; + } + Plugin *plugin = (Plugin*)plugin_set->first; + int64_t startplugin = new_plugin_set->length(); + for( ; plugin ; plugin=(Plugin*)plugin->next ) { + if( plugin->silence() ) continue; + int64_t plugin_start_pos = plugin->startproject; + int64_t plugin_end_pos = plugin_start_pos + plugin->length; + if( plugin_end_pos < start_pos ) continue; + if( plugin_start_pos > end_pos ) break; + if( plugin_start_pos < edit_start_pos ) + plugin_start_pos = edit_start_pos; + if( plugin_end_pos > edit_end_pos ) + plugin_end_pos = edit_end_pos; + if( plugin_start_pos >= plugin_end_pos ) continue; + int64_t plugin_pos = plugin_start_pos - start_pos; + if( !packed && plugin_pos > startplugin ) { + Plugin *silence = new Plugin(new_edl, new_track, ""); + silence->startproject = startplugin; + silence->length = plugin_pos - startplugin; + new_plugin_set->append(silence); + startplugin = plugin_pos; + } + Plugin *new_plugin = new Plugin(new_edl, new_track, plugin->title); + new_plugin->copy_base(plugin); + new_plugin->startproject = startplugin; + new_plugin->length = plugin_end_pos - plugin_start_pos; + startplugin += new_plugin->length; + new_plugin_set->append(new_plugin); + KeyFrames *keyframes = plugin->keyframes; + KeyFrames *new_keyframes = new_plugin->keyframes; + new_keyframes->default_auto->copy_from(keyframes->default_auto); + new_keyframes->default_auto->position = new_plugin->startproject; + KeyFrame *keyframe = (KeyFrame*)keyframes->first; + for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) { + if( keyframe->position < edit_start_pos ) continue; + if( keyframe->position >= edit_end_pos ) break; + KeyFrame *clip_keyframe = new KeyFrame(new_edl, new_keyframes); + clip_keyframe->copy_from(keyframe); + int64_t key_position = keyframe->position - start_pos; + if( packed ) + key_position += new_plugin->startproject - plugin_pos; + clip_keyframe->position = key_position; + new_keyframes->append(clip_keyframe); + } + } + } + } + } + if( last_track == track ) break; + } + return new_edl; +} + +void MWindow::selected_edits_to_clipboard(int packed) +{ + EDL *new_edl = selected_edits_to_clip(packed, 0, 0, + edl->session->labels_follow_edits, + edl->session->autos_follow_edits, + edl->session->plugins_follow_edits); + if( !new_edl ) return; + double length = new_edl->tracks->total_length(); + FileXML file; + new_edl->copy(0, length, 1, &file, "", 1); + const char *file_string = file.string(); + 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); + new_edl->remove_user(); +} + +void MWindow::delete_edit(Edit *edit, const char *msg, int collapse) +{ + ArrayList edits; + edits.append(edit); + delete_edits(&edits, msg, collapse); +} + +void MWindow::delete_edits(ArrayList *edits, const char *msg, int collapse) +{ + if( !edits->size() ) return; + undo->update_undo_before(); + edl->delete_edits(edits, collapse); + save_backup(); + undo->update_undo_after(msg, LOAD_EDITS); + + restart_brender(); + cwindow->refresh_frame(CHANGE_EDL); + update_plugin_guis(); + gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0); +} + +void MWindow::delete_edits(int collapse) +{ + ArrayList edits; + edl->tracks->get_selected_edits(&edits); + delete_edits(&edits,_("del edit"), collapse); +} + +// collapse - delete from timeline, not collapse replace with silence +// packed - omit unselected from selection, unpacked - replace unselected with silence +void MWindow::cut_selected_edits(int collapse, int packed) +{ + selected_edits_to_clipboard(packed); + ArrayList edits; + edl->tracks->get_selected_edits(&edits); + delete_edits(&edits, _("cut edit"), collapse); +} + + void MWindow::move_edits(ArrayList *edits, Track *track, double position, @@ -910,13 +1135,16 @@ void MWindow::move_edits(ArrayList *edits, { undo->update_undo_before(); - edl->tracks->move_edits(edits, - track, - position, + EDL *clip = selected_edits_to_clip(1, 0, 0, + edl->session->labels_follow_edits, + edl->session->autos_follow_edits, + edl->session->plugins_follow_edits); + edl->delete_edits(edits, 0); + paste_edits(clip, track, position, behaviour, 1, edl->session->labels_follow_edits, - edl->session->plugins_follow_edits, edl->session->autos_follow_edits, - behaviour); + edl->session->plugins_follow_edits); + edl->tracks->clear_selected_edits(); save_backup(); undo->update_undo_after(_("move edit"), LOAD_ALL); @@ -925,8 +1153,141 @@ void MWindow::move_edits(ArrayList *edits, cwindow->refresh_frame(CHANGE_EDL); update_plugin_guis(); - gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh - 1, 0, 0, 0, 0); + gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0); +} + +void MWindow::paste_edits(EDL *clip, Track *first_track, double position, int overwrite, + int edit_edits, int edit_labels, int edit_autos, int edit_plugins) +{ + if( edit_labels ) { + Label *edl_label = edl->labels->first; + for( Label *label=clip->labels->first; label; label=label->next ) { + double label_pos = position + label->position; + int exists = 0; + while( edl_label && + !(exists=edl->equivalent(edl_label->position, label_pos)) && + edl_label->position < position ) edl_label = edl_label->next; + if( exists ) continue; + edl->labels->insert_before(edl_label, + new Label(edl, edl->labels, label_pos, label->textstr)); + } + } + + if( !first_track ) + first_track = edl->tracks->first; + Track *src = clip->tracks->first; + for( Track *track=first_track; track && src; track=track->next ) { + if( !track->record ) continue; + int64_t pos = track->to_units(position, 0); + if( edit_edits ) { + for( Edit *edit=src->edits->first; edit; edit=edit->next ) { + if( edit->silence() ) continue; + int64_t start = pos + edit->startproject; + int64_t end = start + edit->length; + if( overwrite ) + track->edits->clear(start, end); + Edit *dst = track->edits->insert_new_edit(start); + dst->copy_from(edit); + dst->startproject = start; + dst->is_selected = 1; + while( (dst=dst->next) != 0 ) + dst->startproject += edit->length; + } + } + if( edit_autos ) { + for( int i=0; iautomation->autos[i]; + if( !src_autos ) continue; + Autos *autos = track->automation->autos[i]; + for( Auto *aut0=src_autos->first; aut0; aut0=aut0->next ) { + int64_t auto_pos = pos + aut0->position; + autos->insert_auto(auto_pos, aut0); + } + } + } + if( edit_plugins ) { + for( int i=0; iplugin_set.size(); ++i ) { + PluginSet *plugin_set = src->plugin_set[i]; + if( !plugin_set ) continue; + while( i >= track->plugin_set.size() ) + track->plugin_set.append(0); + PluginSet *dst_plugin_set = track->plugin_set[i]; + if( !dst_plugin_set ) { + dst_plugin_set = new PluginSet(edl, track); + track->plugin_set[i] = dst_plugin_set; + } + Plugin *plugin = (Plugin *)plugin_set->first; + if( plugin ) track->expand_view = 1; + for( ; plugin; plugin=(Plugin *)plugin->next ) { + int64_t start = pos + plugin->startproject; + int64_t end = start + plugin->length; + if( overwrite ) + dst_plugin_set->clear(start, end, 1); + Plugin *dst = dst_plugin_set->insert_plugin( + plugin->title, start, end-start, + plugin->plugin_type, &plugin->shared_location, + (KeyFrame*)plugin->keyframes->default_auto, 0); + KeyFrame *keyframe = (KeyFrame*)plugin->keyframes->first; + for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) { + int64_t keyframe_pos = pos + keyframe->position; + dst->keyframes->insert_auto(keyframe_pos, keyframe); + } + } + } + } + track->optimize(); + src = src->next; + } +} + +void MWindow::paste_clipboard(Track *first_track, double position, int overwrite, + int edit_edits, int edit_labels, int edit_autos, int edit_plugins) +{ + int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION); + if( !len ) return; + char *string = new char[len]; + gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); + FileXML file; + file.read_from_string(string); + delete [] string; + EDL *clip = new EDL(); + clip->create_objects(); + if( !clip->load_xml(&file, LOAD_ALL) ) { + undo->update_undo_before(); + paste_edits(clip, first_track, position, overwrite, + edit_edits, edit_labels, edit_autos, edit_plugins); + save_backup(); + undo->update_undo_after(_("paste clip"), LOAD_ALL); + restart_brender(); + cwindow->refresh_frame(CHANGE_EDL); + + update_plugin_guis(); + gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0); + } + clip->remove_user(); +} + +void MWindow::move_group(EDL *group, Track *first_track, double position, int overwrite) +{ + undo->update_undo_before(); + + ArrayListedits; + edl->tracks->get_selected_edits(&edits); + edl->delete_edits(&edits, 0); + paste_edits(group, first_track, position, overwrite, 1, + edl->session->labels_follow_edits, + edl->session->plugins_follow_edits, + edl->session->autos_follow_edits); +// big debate over whether to do this, must either clear selected, or no tweaking +// edl->tracks->clear_selected_edits(); + + save_backup(); + undo->update_undo_after(_("move group"), LOAD_ALL); + restart_brender(); + cwindow->refresh_frame(CHANGE_EDL); + + update_plugin_guis(); + gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0); } void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position) @@ -939,8 +1300,7 @@ void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position) restart_brender(); cwindow->refresh_frame(CHANGE_EDL); update_plugin_guis(); - gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh - 0, 0, 0, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0); } void MWindow::move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position) @@ -953,8 +1313,7 @@ void MWindow::move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t positio restart_brender(); cwindow->refresh_frame(CHANGE_EDL); update_plugin_guis(); - gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh - 0, 0, 0, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0); } void MWindow::move_plugins_up(PluginSet *plugin_set) @@ -966,8 +1325,7 @@ void MWindow::move_plugins_up(PluginSet *plugin_set) save_backup(); undo->update_undo_after(_("move effect up"), LOAD_ALL); restart_brender(); - gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh - 0, 0, 0, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -980,8 +1338,7 @@ void MWindow::move_plugins_down(PluginSet *plugin_set) save_backup(); undo->update_undo_after(_("move effect down"), LOAD_ALL); restart_brender(); - gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh - 0, 0, 0, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -993,7 +1350,7 @@ void MWindow::move_track_down(Track *track) undo->update_undo_after(_("move track down"), LOAD_ALL); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); sync_parameters(CHANGE_EDL); save_backup(); } @@ -1006,7 +1363,7 @@ void MWindow::move_tracks_down() undo->update_undo_after(_("move tracks down"), LOAD_ALL); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); sync_parameters(CHANGE_EDL); save_backup(); } @@ -1018,7 +1375,7 @@ void MWindow::move_track_up(Track *track) save_backup(); undo->update_undo_after(_("move track up"), LOAD_ALL); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); sync_parameters(CHANGE_EDL); save_backup(); } @@ -1030,7 +1387,7 @@ void MWindow::move_tracks_up() save_backup(); undo->update_undo_after(_("move tracks up"), LOAD_ALL); restart_brender(); - gui->update(1, 1, 0, 0, 1, 0, 0); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); sync_parameters(CHANGE_EDL); } @@ -1055,7 +1412,7 @@ void MWindow::mute_selection() restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->refresh_frame(CHANGE_EDL); } } @@ -1094,8 +1451,7 @@ void MWindow::overwrite(EDL *source, int all) edl->local_session->get_outpoint() < 0 ) edl->clear(dst_start, dst_start + overwrite_len, 0, 0, 0); - paste(dst_start, dst_start + overwrite_len, - &file, 0, 0, 0); + paste(dst_start, dst_start + overwrite_len, &file, 0, 0, 0, 0, 0); edl->local_session->set_selectionstart(dst_start + overwrite_len); edl->local_session->set_selectionend(dst_start + overwrite_len); @@ -1105,24 +1461,21 @@ void MWindow::overwrite(EDL *source, int all) restart_brender(); update_plugin_guis(); - gui->update(1, 1, 1, 1, 0, 1, 0); + gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0); sync_parameters(CHANGE_EDL); } // For splice and overwrite -int MWindow::paste(double start, - double end, - FileXML *file, - int edit_labels, - int edit_plugins, - int edit_autos) +int MWindow::paste(double start, double end, FileXML *file, + int edit_labels, int edit_plugins, int edit_autos, + Track *first_track, int overwrite) { clear(0); // Want to insert with assets shared with the master EDL. insert(start, file, edit_labels, edit_plugins, edit_autos, - edl); + edl, first_track, overwrite); return 0; } @@ -1130,7 +1483,11 @@ int MWindow::paste(double start, // For editing using insertion point void MWindow::paste() { - double start = edl->local_session->get_selectionstart(); + paste(edl->local_session->get_selectionstart(), 0, 1, 0); +} + +void MWindow::paste(double start, Track *first_track, int clear_selection, int overwrite) +{ //double end = edl->local_session->get_selectionend(); int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION); @@ -1140,13 +1497,13 @@ void MWindow::paste() gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); - clear(0); + if( clear_selection ) clear(0); insert(start, &file, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, - 0); + 0, first_track, overwrite); edl->optimize(); delete [] string; @@ -1156,7 +1513,7 @@ void MWindow::paste() undo->update_undo_after(_("paste"), LOAD_EDITS | LOAD_TIMEBAR); restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 0, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 0, 1, 0); awindow->gui->async_update_assets(); sync_parameters(CHANGE_EDL); } @@ -1192,7 +1549,7 @@ int MWindow::paste_assets(double position, Track *dest_track, int overwrite) undo->update_undo_after(_("paste assets"), LOAD_EDITS); restart_brender(); - gui->update(1, 2, 1, 0, 0, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 0, 0, 1, 0); sync_parameters(CHANGE_EDL); return result; } @@ -1486,7 +1843,7 @@ int MWindow::paste_edls(ArrayList *new_edls, int load_mode, edl_length, edit_labels); //PRINT_TRACE - + double total_length = new_edl->tracks->total_length(); for( Track *new_track=new_edl->tracks->first; new_track; new_track=new_track->next ) { // Get destination track of same type as new_track @@ -1525,11 +1882,12 @@ int MWindow::paste_edls(ArrayList *new_edls, int load_mode, break; } if( overwrite ) { + double length = overwrite >= 0 ? + new_track->get_length() : total_length; track->clear(current_position, - current_position + new_track->get_length(), + current_position + length, 1, // edit edits edit_labels, edit_plugins, edit_autos, - 1, // convert units 0); // trim edits } //PRINT_TRACE @@ -1619,7 +1977,7 @@ void MWindow::paste_silence() update_plugin_guis(); restart_brender(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); cwindow->refresh_frame(CHANGE_EDL); } @@ -1634,7 +1992,7 @@ void MWindow::detach_transition(Transition *transition) undo->update_undo_after(_("detach transition"), LOAD_ALL); if( is_video ) restart_brender(); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -1651,7 +2009,7 @@ void MWindow::detach_transitions() undo->update_undo_after(_("detach transitions"), LOAD_EDITS); sync_parameters(CHANGE_EDL); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); } @@ -1681,7 +2039,7 @@ void MWindow::paste_transitions(int track_type, char *title) undo->update_undo_after(_("attach transitions"), LOAD_EDITS); sync_parameters(CHANGE_EDL); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); } @@ -1693,7 +2051,7 @@ void MWindow::paste_transition_cwindow(Track *dest_track) save_backup(); undo->update_undo_after(_("transition"), LOAD_EDITS); restart_brender(); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); sync_parameters(CHANGE_ALL); } @@ -1714,7 +2072,7 @@ void MWindow::paste_audio_transition() undo->update_undo_after(_("transition"), LOAD_EDITS); sync_parameters(CHANGE_EDL); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); } void MWindow::paste_video_transition() @@ -1736,7 +2094,7 @@ void MWindow::paste_video_transition() sync_parameters(CHANGE_EDL); restart_brender(); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); } void MWindow::shuffle_edits() @@ -1754,7 +2112,7 @@ void MWindow::shuffle_edits() sync_parameters(CHANGE_EDL); restart_brender(); - gui->update(0, 1, 1, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0); gui->unlock_window(); } @@ -1773,7 +2131,7 @@ void MWindow::reverse_edits() sync_parameters(CHANGE_EDL); restart_brender(); - gui->update(0, 1, 1, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0); gui->unlock_window(); } @@ -1792,7 +2150,7 @@ void MWindow::align_edits() sync_parameters(CHANGE_EDL); restart_brender(); - gui->update(0, 1, 1, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0); gui->unlock_window(); } @@ -1811,7 +2169,7 @@ void MWindow::set_edit_length(double length) sync_parameters(CHANGE_EDL); restart_brender(); - gui->update(0, 1, 1, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 1, 0, 0, 0, 0); gui->unlock_window(); } @@ -1831,7 +2189,7 @@ void MWindow::set_transition_length(Transition *transition, double length) edl->session->default_transition_length = length; sync_parameters(CHANGE_PARAMS); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); } @@ -1851,7 +2209,7 @@ void MWindow::set_transition_length(double length) edl->session->default_transition_length = length; sync_parameters(CHANGE_PARAMS); restart_brender(); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); } @@ -1880,7 +2238,7 @@ void MWindow::redo_entry(BC_WindowBase *calling_window_gui) update_plugin_states(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 1); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 1); gui->update_proxy_toggle(); gui->unlock_window(); cwindow->update(1, 1, 1, 1, 1); @@ -2011,7 +2369,8 @@ void MWindow::splice(EDL *source, int all) paste(start, start, &file, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, - edl->session->autos_follow_edits); + edl->session->autos_follow_edits, + 0, 0); // Position at end of clip edl->local_session->set_selectionstart(start + source_end - source_start); @@ -2021,7 +2380,7 @@ void MWindow::splice(EDL *source, int all) undo->update_undo_after(_("splice"), LOAD_EDITS | LOAD_TIMEBAR); update_plugin_guis(); restart_brender(); - gui->update(1, 1, 1, 1, 0, 1, 0); + gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0); sync_parameters(CHANGE_EDL); } @@ -2175,7 +2534,7 @@ void MWindow::trim_selection() save_backup(); undo->update_undo_after(_("trim selection"), LOAD_EDITS | LOAD_TIMEBAR); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); awindow->gui->async_update_assets(); restart_brender(); @@ -2207,7 +2566,7 @@ void MWindow::undo_entry(BC_WindowBase *calling_window_gui) update_plugin_states(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 1); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 1); gui->update_proxy_toggle(); gui->unlock_window(); cwindow->update(1, 1, 1, 1, 1); @@ -2283,7 +2642,7 @@ void MWindow::map_audio(int pattern) pattern == MWindow::AUDIO_1_TO_1 ? _("map 1:1") : _("map 5.1:2"), LOAD_AUTOMATION); sync_parameters(CHANGE_PARAMS); - gui->update(0, 1, 0, 0, 1, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 1, 0, 0); } void MWindow::remap_audio(int pattern) @@ -2357,7 +2716,7 @@ void MWindow::cut_commercials() restart_brender(); update_plugin_guis(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); cwindow->refresh_frame(CHANGE_EDL); #endif