From: Good Guy Date: Mon, 7 Jan 2019 23:44:45 +0000 (-0700) Subject: group edge handle drag, expanders.txt, delete spurious auto in copy edl X-Git-Tag: 2019-08~123 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=ab209efd7893132268c7dc159cd78a4574276946;p=goodguy%2Fcinelerra.git group edge handle drag, expanders.txt, delete spurious auto in copy edl --- diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index ced07836..490094cd 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -503,9 +503,6 @@ int Autos::copy(int64_t start, if(active_only || (!default_only && !active_only)) { Auto *current = autoof(start); -// need the last one if past the end - if( !current && last ) - last->copy(start, end, file, default_only); while( current && current->position <= end ) { // Want to copy single keyframes by putting the cursor on them diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index a38bef5a..fcf8c214 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -703,23 +703,37 @@ int Edits::clear_handle(double start, double end, int Edits::modify_handles(double oldposition, double newposition, int currentend, int edit_mode, int edit_edits, int edit_labels, int edit_plugins, int edit_autos, - Edits *trim_edits) + Edits *trim_edits, int group_id) { int result = 0; Edit *current_edit; + Edit *left = 0, *right = 0; + if( group_id > 0 ) { + double start = DBL_MAX, end = DBL_MIN; + for( Edit *edit=first; edit; edit=edit->next ) { + if( edit->group_id != group_id ) continue; + double edit_start = edit->track->from_units(edit->startproject); + if( edit_start < start ) { start = edit_start; left = edit; } + double edit_end = edit->track->from_units(edit->startproject+edit->length); + if( edit_end > end ) { end = edit_end; right = edit; } + } + } //printf("Edits::modify_handles 1 %d %f %f\n", currentend, newposition, oldposition); if(currentend == 0) { // left handle for(current_edit = first; current_edit && !result;) { - if(edl->equivalent(track->from_units(current_edit->startproject), - oldposition)) { + if( group_id > 0 ? current_edit == left : + edl->equivalent(track->from_units(current_edit->startproject), + oldposition) ) { // edit matches selection //printf("Edits::modify_handles 3 %f %f\n", newposition, oldposition); + double delta = newposition - oldposition; oldposition = track->from_units(current_edit->startproject); + if( group_id > 0 ) newposition = oldposition + delta; result = 1; - if(newposition >= oldposition) { + if( newposition >= oldposition ) { //printf("Edits::modify_handle 1 %s %f %f\n", track->title, oldposition, newposition); // shift start of edit in current_edit->shift_start_in(edit_mode, @@ -731,8 +745,7 @@ int Edits::modify_handles(double oldposition, double newposition, int currentend edit_autos, trim_edits); } - else - { + else { //printf("Edits::modify_handle 2 %s\n", track->title); // move start of edit out current_edit->shift_start_out(edit_mode, @@ -752,10 +765,13 @@ int Edits::modify_handles(double oldposition, double newposition, int currentend else { // right handle selected for(current_edit = first; current_edit && !result;) { - if(edl->equivalent(track->from_units(current_edit->startproject) + - track->from_units(current_edit->length), oldposition)) { - oldposition = track->from_units(current_edit->startproject) + + if( group_id > 0 ? current_edit == right : + edl->equivalent(track->from_units(current_edit->startproject) + + track->from_units(current_edit->length), oldposition) ) { + double delta = newposition - oldposition; + oldposition = track->from_units(current_edit->startproject) + track->from_units(current_edit->length); + if( group_id > 0 ) newposition = oldposition + delta; result = 1; //printf("Edits::modify_handle 3\n"); @@ -797,7 +813,6 @@ int Edits::modify_handles(double oldposition, double newposition, int currentend return 0; } - void Edits::paste_silence(int64_t start, int64_t end) { Edit *new_edit = editof(start, PLAY_FORWARD, 0); diff --git a/cinelerra-5.1/cinelerra/edits.h b/cinelerra-5.1/cinelerra/edits.h index c0f2cdf0..76c0171d 100644 --- a/cinelerra-5.1/cinelerra/edits.h +++ b/cinelerra-5.1/cinelerra/edits.h @@ -116,15 +116,10 @@ public: // ==================================== editing - int modify_handles(double oldposition, - double newposition, - int currentend, - int edit_mode, - int edit_edits, - int edit_labels, - int edit_plugins, - int edit_autos, - Edits *trim_edits); + int modify_handles(double oldposition, double newposition, + int currentend, int edit_mode, int edit_edits, int edit_labels, + int edit_plugins, int edit_autos, Edits *trim_edits, int group_id); + virtual int optimize(); virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 7b2304bd..c7db139e 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -914,58 +914,33 @@ void EDL::move_edit_labels(ArrayList *edits, double dist) } -void EDL::modify_edithandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos) +void EDL::modify_edithandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id) { - tracks->modify_edithandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_plugins, - edit_autos); - labels->modify_handles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels); -} - -void EDL::modify_pluginhandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_autos, - Edits *trim_edits) -{ - tracks->modify_pluginhandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_autos, - trim_edits); + tracks->modify_edithandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_plugins, edit_autos, group_id); + labels->modify_handles(oldposition, newposition, + currentend, handle_mode, edit_labels); +} + +void EDL::modify_pluginhandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_autos, Edits *trim_edits) +{ + tracks->modify_pluginhandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_autos, trim_edits); optimize(); } -void EDL::paste_silence(double start, - double end, - int edit_labels, - int edit_plugins, - int edit_autos) +void EDL::paste_silence(double start, double end, + int edit_labels, int edit_plugins, int edit_autos) { if( edit_labels ) labels->paste_silence(start, end); - tracks->paste_silence(start, - end, - edit_plugins, - edit_autos); + tracks->paste_silence(start, end, edit_plugins, edit_autos); } diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index 6ec34c8f..22c9332c 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -172,27 +172,16 @@ public: void delete_edit_labels(ArrayList *edits, int collapse); void move_edit_labels(ArrayList *edits, double dist); - void modify_edithandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos); + void modify_edithandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id); - void modify_pluginhandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_autos, - Edits *trim_edits); - - int trim_selection(double start, - double end, - int edit_labels, - int edit_plugins, - int edit_autos); + void modify_pluginhandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_autos, Edits *trim_edits); + + int trim_selection(double start, double end, + int edit_labels, int edit_plugins, int edit_autos); // Editing functions int copy_assets(double start, double end, diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 0d979ac8..c64ab7c1 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -831,7 +831,8 @@ int MWindow::modify_edithandles() edl->session->edit_handle_mode[session->drag_button], edl->session->labels_follow_edits, edl->session->plugins_follow_edits, - edl->session->autos_follow_edits); + edl->session->autos_follow_edits, + session->drag_edit->group_id); finish_modify_handles(); //printf("MWindow::modify_handles 1\n"); @@ -1205,6 +1206,8 @@ void MWindow::paste_edits(EDL *clip, Track *first_track, double position, int ov for( ; plugin; plugin=(Plugin *)plugin->next ) { if( plugin->startproject >= start ) plugin->startproject += edit->length; + else if( plugin->startproject+plugin->length > end ) + plugin->length += end - start; Auto *default_keyframe = plugin->keyframes->default_auto; if( default_keyframe->position >= start ) default_keyframe->position += edit->length; @@ -1214,6 +1217,7 @@ void MWindow::paste_edits(EDL *clip, Track *first_track, double position, int ov keyframe->position += edit->length; } } + plugin_set->optimize(); } } } @@ -1245,16 +1249,15 @@ void MWindow::paste_edits(EDL *clip, Track *first_track, double position, int ov for( ; plugin; plugin=(Plugin *)plugin->next ) { int64_t start = pos + plugin->startproject; int64_t end = start + plugin->length; - if( overwrite ) + if( overwrite || edit_edits ) 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, + Plugin *new_plugin = 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); + new_plugin->keyframes->insert_auto(keyframe_pos, keyframe); } } } diff --git a/cinelerra-5.1/cinelerra/plugin.C b/cinelerra-5.1/cinelerra/plugin.C index b4c8e443..5890808b 100644 --- a/cinelerra-5.1/cinelerra/plugin.C +++ b/cinelerra-5.1/cinelerra/plugin.C @@ -109,6 +109,20 @@ void Plugin::clear_keyframes(int64_t start, int64_t end) } +void Plugin::init(const char *title, + int64_t unit_position, int64_t unit_length, int plugin_type, + SharedLocation *shared_location, KeyFrame *default_keyframe) +{ + if( title ) strcpy(this->title, title); + if( shared_location ) this->shared_location = *shared_location; + this->plugin_type = plugin_type; + if( default_keyframe ) + *this->keyframes->default_auto = *default_keyframe; + this->keyframes->default_auto->position = unit_position; + this->startproject = unit_position; + this->length = unit_length; +} + void Plugin::copy_base(Edit *edit) { Plugin *plugin = (Plugin*)edit; diff --git a/cinelerra-5.1/cinelerra/plugin.h b/cinelerra-5.1/cinelerra/plugin.h index 220066cf..279a7de6 100644 --- a/cinelerra-5.1/cinelerra/plugin.h +++ b/cinelerra-5.1/cinelerra/plugin.h @@ -74,6 +74,9 @@ public: virtual int operator==(Plugin& that); virtual int operator==(Edit& that); + void init(const char *title, + int64_t unit_position, int64_t unit_length, int plugin_type, + SharedLocation *shared_location, KeyFrame *default_keyframe); void copy_base(Edit *edit); virtual void copy_from(Edit *edit); diff --git a/cinelerra-5.1/cinelerra/pluginset.C b/cinelerra-5.1/cinelerra/pluginset.C index 6805d8ae..cdc4a784 100644 --- a/cinelerra-5.1/cinelerra/pluginset.C +++ b/cinelerra-5.1/cinelerra/pluginset.C @@ -138,24 +138,15 @@ void PluginSet::synchronize_params(PluginSet *plugin_set) } Plugin* PluginSet::insert_plugin(const char *title, - int64_t unit_position, - int64_t unit_length, - int plugin_type, - SharedLocation *shared_location, - KeyFrame *default_keyframe, + int64_t unit_position, int64_t unit_length, int plugin_type, + SharedLocation *shared_location, KeyFrame *default_keyframe, int do_optimize) { Plugin *plugin = (Plugin*)create_silence(unit_position, unit_position + unit_length); - if(title) strcpy(plugin->title, title); - if(shared_location) plugin->shared_location = *shared_location; - plugin->plugin_type = plugin_type; - - if(default_keyframe) - *plugin->keyframes->default_auto = *default_keyframe; - plugin->keyframes->default_auto->position = unit_position; - + plugin->init(title, unit_position, unit_length, plugin_type, + shared_location, default_keyframe); // May delete the plugin we just added so not desirable while loading. - if(do_optimize) optimize(); + if( do_optimize ) optimize(); return plugin; } diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index ddbc3837..482cbb1e 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -1220,25 +1220,13 @@ int Track::popup_transition(int cursor_x, int cursor_y) -int Track::modify_edithandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos) +int Track::modify_edithandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id) { - edits->modify_handles(oldposition, - newposition, - currentend, - handle_mode, - 1, - edit_labels, - edit_plugins, - edit_autos, - 0); - - + edits->modify_handles(oldposition, newposition, + currentend, handle_mode, 1, edit_labels, edit_plugins, + edit_autos, 0, group_id); return 0; } @@ -1253,16 +1241,10 @@ int Track::modify_pluginhandles(double oldposition, for(int i = 0; i < plugin_set.total; i++) { if(!trim_edits || trim_edits == (Edits*)plugin_set.values[i]) - plugin_set.values[i]->modify_handles(oldposition, - newposition, - currentend, - handle_mode, + plugin_set.values[i]->modify_handles(oldposition, newposition, // Don't allow plugin tweeks to affect edits. - 0, - edit_labels, - 1, - edit_autos, - trim_edits); + currentend, handle_mode, 0, + edit_labels, 1, edit_autos, trim_edits, 0); } return 0; } diff --git a/cinelerra-5.1/cinelerra/track.h b/cinelerra-5.1/cinelerra/track.h index e2326cbc..c879c40e 100644 --- a/cinelerra-5.1/cinelerra/track.h +++ b/cinelerra-5.1/cinelerra/track.h @@ -257,13 +257,9 @@ public: int popup_transition(int cursor_x, int cursor_y); // Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable - int modify_edithandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos); + int modify_edithandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id); int modify_pluginhandles(double oldposition, double newposition, int currentend, diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index cf20fe90..07e4f49a 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -3757,7 +3757,8 @@ void TrackCanvas::update_drag_handle() edit_mode, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, - edl->session->autos_follow_edits); + edl->session->autos_follow_edits, + session->drag_edit->group_id); double position = edit_mode != MOVE_NO_EDITS && ( session->drag_handle || edit_mode == MOVE_ONE_EDIT ) ? session->drag_position : session->drag_start; diff --git a/cinelerra-5.1/cinelerra/tracks.h b/cinelerra-5.1/cinelerra/tracks.h index 0cc248d0..1f3c288e 100644 --- a/cinelerra-5.1/cinelerra/tracks.h +++ b/cinelerra-5.1/cinelerra/tracks.h @@ -217,13 +217,9 @@ public: int popup_transition(int cursor_x, int cursor_y); int select_auto(int cursor_x, int cursor_y); int move_auto(int cursor_x, int cursor_y, int shift_down); - int modify_edithandles(double &oldposition, - double &newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos); + int modify_edithandles(double &oldposition, double &newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id); int modify_pluginhandles(double &oldposition, double &newposition, int currentend, diff --git a/cinelerra-5.1/cinelerra/tracksedit.C b/cinelerra-5.1/cinelerra/tracksedit.C index c050f5f8..4b23eb1e 100644 --- a/cinelerra-5.1/cinelerra/tracksedit.C +++ b/cinelerra-5.1/cinelerra/tracksedit.C @@ -1227,60 +1227,33 @@ int Tracks::move_auto(int cursor_x, int cursor_y, int shift_down) return 0; } -int Tracks::modify_edithandles(double &oldposition, - double &newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos) +int Tracks::modify_edithandles(double &oldposition, double &newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id) { - Track *current; - - for(current = first; current; current = NEXT) - { - if(current->record) - { - current->modify_edithandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_plugins, - edit_autos); - } + for( Track *track=first; track; track=track->next ) { + if( !track->record ) continue; + track->modify_edithandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_plugins, edit_autos, group_id); } return 0; } -int Tracks::modify_pluginhandles(double &oldposition, - double &newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_autos, - Edits *trim_edits) +int Tracks::modify_pluginhandles(double &oldposition, double &newposition, + int currentend, int handle_mode, int edit_labels, + int edit_autos, Edits *trim_edits) { - Track *current; - - for(current = first; current; current = NEXT) - { - if(current->record) - { - current->modify_pluginhandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_autos, - trim_edits); - } + for( Track *track=first; track; track=track->next ) { + if( !track->record ) continue; + track->modify_pluginhandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_autos, trim_edits); } return 0; } - int Tracks::purge_asset(Asset *asset) { Track *current_track; diff --git a/cinelerra-5.1/expanders.txt b/cinelerra-5.1/expanders.txt index aa7fa82e..27ee8ff2 100644 --- a/cinelerra-5.1/expanders.txt +++ b/cinelerra-5.1/expanders.txt @@ -152,6 +152,7 @@ Video Effects Delay Video Freeze Frame Loop video + Interpolate Video ReframeRT Reverse video Time Average