X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowedit.C;h=003844fe9a61698083240ba6f8dbd0a6ae059676;hb=232ae3c6972c1740b6e1890ccce1264f2bb311f5;hp=7b359ce2d817bb5672049bf4ea03a2c4f6143acd;hpb=0678b17975f50a831fb8a1cda6baaa961e3b6de7;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 7b359ce2..003844fe 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -960,6 +960,34 @@ void MWindow::finish_modify_handles() cwindow->update(1, 0, 0, 0, 1); } +int MWindow::modify_transnhandles() +{ + gui->reset_default_message(); + gui->default_message(); + Transition *transition = session->drag_transition; + if( !transition ) return 1; + int64_t length = transition->length; + Track *track = transition->edit->track; + int64_t start_pos = track->to_units(session->drag_start, 0); + int64_t end_pos = track->to_units(session->drag_position, 0); + length += end_pos - start_pos; + if( length < 0 ) length = 0; + if( length == transition->length ) return 0; + + undo_before(); + transition->length = length; + undo_after(_("trans handle"), LOAD_EDITS); + + save_backup(); + restart_brender(); + sync_parameters(CHANGE_EDL); + update_plugin_guis(); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); + cwindow->update(1, 0, 0, 0, 1); + + return 0; +} + void MWindow::match_output_size(Track *track) { undo_before(); @@ -1562,7 +1590,7 @@ int MWindow::paste_edls(ArrayList *new_edls, int load_mode, // Delete current project if( load_mode == LOADMODE_REPLACE || load_mode == LOADMODE_REPLACE_CONCATENATE ) { - reset_caches(); + reset_caches(1); edl->save_defaults(defaults); hide_plugins(); edl->Garbage::remove_user(); @@ -2602,56 +2630,46 @@ int MWindow::normalize_speed(EDL *old_edl, EDL *new_edl, int edit_speed) old_speed = (FloatAuto *)old_speed->next; new_speed = (FloatAuto *)new_speed->next; } + if( !old_speed && !new_speed ) continue; + result = 1; if( edit_speed ) { Autos *old_autos = old_track->automation->autos[AUTOMATION_SPEED]; Autos *new_autos = new_track->automation->autos[AUTOMATION_SPEED]; Auto *old_auto = old_autos ? old_autos->first : 0; - Auto *new_auto = new_autos ? new_autos->first : 0; - while( old_auto && new_auto ) { + for( ; old_auto; old_auto=old_auto->next ) { + Auto *new_auto = new_autos->get_auto(old_auto->orig_id); + if( !new_auto ) continue; int64_t auto_pos = old_auto->position; - if( old_speed || new_speed ) { - double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); - auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); - result = 1; - } + double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); + auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); new_auto->position = auto_pos; - old_auto = old_auto->next; - new_auto = new_auto->next; } } Edit *old_edit = old_track->edits->first; - Edit *new_edit = new_track->edits->first; - while( old_edit && new_edit ) { + for( ; old_edit; old_edit=old_edit->next ) { + Edit *new_edit = new_track->edits->get_edit(old_edit->orig_id); + if( !new_edit ) continue; int64_t edit_start = old_edit->startproject; int64_t edit_end = edit_start + old_edit->length; - if( old_speed || new_speed ) { - double orig_start = old_speeds->automation_integral(0, edit_start, PLAY_FORWARD); - double orig_end = old_speeds->automation_integral(0, edit_end, PLAY_FORWARD); - edit_start = new_track->frame_align(new_speeds->speed_position(orig_start), 1); - edit_end = new_track->frame_align(new_speeds->speed_position(orig_end), 1); - result = 1; - } + double orig_start = old_speeds->automation_integral(0, edit_start, PLAY_FORWARD); + double orig_end = old_speeds->automation_integral(0, edit_end, PLAY_FORWARD); + edit_start = new_track->frame_align(new_speeds->speed_position(orig_start), 1); + edit_end = new_track->frame_align(new_speeds->speed_position(orig_end), 1); new_edit->startproject = edit_start; new_edit->length = edit_end - edit_start; - old_edit = old_edit->next; - new_edit = new_edit->next; } if( first_track && old_track->is_armed() ) { - if( edit_labels ) { - Labels *old_labels = old_edl->labels; - Labels *new_labels = new_edl->labels; - Label *old_label = old_labels ? old_labels->first : 0; - Label *new_label = new_labels ? new_labels->first : 0; - while( old_label && new_label ) { + Labels *old_labels = old_edl->labels; + Labels *new_labels = new_edl->labels; + if( edit_labels && old_labels && new_labels ) { + Label *old_label = old_labels->first; + for( ; old_label; old_label=old_label->next ) { + Label *new_label = new_labels->get_label(old_label->orig_id); + if( !new_label ) continue; int64_t label_pos = old_track->to_units(old_label->position, 1); - if( old_speed || new_speed ) { - double orig_pos = old_speeds->automation_integral(0, label_pos, PLAY_FORWARD); - label_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); - result = 1; - } + double orig_pos = old_speeds->automation_integral(0, label_pos, PLAY_FORWARD); + label_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); new_label->position = new_track->from_units(label_pos); - old_label = old_label->next; - new_label = new_label->next; } } first_track = 0; @@ -2662,59 +2680,54 @@ int MWindow::normalize_speed(EDL *old_edl, EDL *new_edl, int edit_speed) int n = bmin(old_size, new_size); for( int i=0; iplugin_set[i]; - Plugin *old_plugin = (Plugin *)(old_plugin_set ? old_plugin_set->first : 0); + if( !old_plugin_set ) continue; PluginSet *new_plugin_set = new_track->plugin_set[i]; - Plugin *new_plugin = (Plugin *)(new_plugin_set ? new_plugin_set->first : 0); - while( old_plugin && new_plugin ) { + if( !new_plugin_set ) continue; + Plugin *old_plugin = (Plugin *)old_plugin_set->first; + for( ; old_plugin; old_plugin=(Plugin *)old_plugin->next ) { + Plugin *new_plugin = (Plugin *)new_plugin_set->get_edit(old_plugin->orig_id); + if( !new_plugin ) continue; int64_t plugin_start = old_plugin->startproject; int64_t plugin_end = plugin_start + old_plugin->length; - if( old_speed || new_speed ) { - double orig_start = old_speeds->automation_integral(0, plugin_start, PLAY_FORWARD); - double orig_end = old_speeds->automation_integral(0, plugin_end, PLAY_FORWARD); - plugin_start = new_track->frame_align(new_speeds->speed_position(orig_start), 1); - plugin_end = new_track->frame_align(new_speeds->speed_position(orig_end), 1); - result = 1; - } + double orig_start = old_speeds->automation_integral(0, plugin_start, PLAY_FORWARD); + double orig_end = old_speeds->automation_integral(0, plugin_end, PLAY_FORWARD); + plugin_start = new_track->frame_align(new_speeds->speed_position(orig_start), 1); + plugin_end = new_track->frame_align(new_speeds->speed_position(orig_end), 1); new_plugin->startproject = plugin_start; new_plugin->length = plugin_end - plugin_start; if( edit_autos ) { KeyFrames *old_keyframes = old_plugin->keyframes; - Auto *old_auto = old_keyframes ? old_keyframes->first : 0; + if( !old_keyframes ) continue; KeyFrames *new_keyframes = new_plugin->keyframes; - Auto *new_auto = new_keyframes ? new_keyframes->first : 0; - while( old_auto && new_auto ) { + if( !new_keyframes ) continue; + Auto *old_auto = old_keyframes->first; + for( ; old_auto; old_auto=old_auto->next ) { + Auto *new_auto = new_keyframes->get_auto(old_auto->orig_id); + if( !new_auto ) continue; int64_t auto_pos = old_auto->position; - if( old_speed || new_speed ) { - double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); - auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); - result = 1; - } + double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); + auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); new_auto->position = auto_pos; old_auto = old_auto->next; - new_auto = new_auto->next; } } - old_plugin = (Plugin *)old_plugin->next; - new_plugin = (Plugin *)new_plugin->next; } } } if( edit_autos ) { // speed must be last for( int i=0; iautomation->autos[i]; + if( !old_autos ) continue; Autos *new_autos = new_track->automation->autos[i]; - Auto *old_auto = old_autos ? old_autos->first : 0; - Auto *new_auto = new_autos ? new_autos->first : 0; - while( old_auto && new_auto ) { + if( !new_autos ) continue; + Auto *old_auto = old_autos->first; + for( ; old_auto; old_auto=old_auto->next ) { + Auto *new_auto = new_autos->get_auto(old_auto->orig_id); + if( !new_auto ) continue; int64_t auto_pos = old_auto->position; - if( old_speed || new_speed ) { - double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); - auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); - result = 1; - } + double orig_pos = old_speeds->automation_integral(0, auto_pos, PLAY_FORWARD); + auto_pos = new_track->frame_align(new_speeds->speed_position(orig_pos), 1); new_auto->position = auto_pos; - old_auto = old_auto->next; - new_auto = new_auto->next; } } }