group edge handle drag, expanders.txt, delete spurious auto in copy edl
authorGood Guy <good1.2guy@gmail.com>
Mon, 7 Jan 2019 23:44:45 +0000 (16:44 -0700)
committerGood Guy <good1.2guy@gmail.com>
Mon, 7 Jan 2019 23:44:45 +0000 (16:44 -0700)
15 files changed:
cinelerra-5.1/cinelerra/autos.C
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/edits.h
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/edl.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/plugin.C
cinelerra-5.1/cinelerra/plugin.h
cinelerra-5.1/cinelerra/pluginset.C
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/track.h
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/tracks.h
cinelerra-5.1/cinelerra/tracksedit.C
cinelerra-5.1/expanders.txt

index ced078364c5578980abe367c9324b39109f1adf9..490094cd368837ca9610d29f864ada4c83b70231 100644 (file)
@@ -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
index a38bef5a0180474154687c026f2953f4850cdaf3..fcf8c214f784930a3d57511db9fe85d66e04689d 100644 (file)
@@ -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);
index c0f2cdf0bbfd753c4167f7d9c2a6b70cd84eefe4..76c0171da50c69c7b792f35f167ee66cfb1107b1 100644 (file)
@@ -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; }
index 7b2304bdc5f17e103e7a15ff648ed16986e6cdcc..c7db139e642db5bc245721bd993313b54bea2960 100644 (file)
@@ -914,58 +914,33 @@ void EDL::move_edit_labels(ArrayList<Edit*> *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);
 }
 
 
index 6ec34c8ff51a513023adba55ae6b9fd8eb78a30f..22c9332c6c067ef02a98ab95561c4cfa6f55a14e 100644 (file)
@@ -172,27 +172,16 @@ public:
        void delete_edit_labels(ArrayList<Edit*> *edits, int collapse);
        void move_edit_labels(ArrayList<Edit*> *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,
index 0d979ac8230c64d8d9c2d8211e0decddfa424e96..c64ab7c158c943d1161c579512cd386f5a241361 100644 (file)
@@ -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);
                                        }
                                }
                        }
index b4c8e4431c216913772eca95c41c3032ea5f329f..5890808b5617010cb93fff45858fb0e2765fcd86 100644 (file)
@@ -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;
index 220066cf4dfb258dd457c0a8b7d659de6b5bf0b9..279a7de68f72df3e9200f752b33427e381123a22 100644 (file)
@@ -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);
 
index 6805d8ae171a7409c9c82a2af9c80c71352bb152..cdc4a7848d1bd7faa778d3bf6274521afc253ea2 100644 (file)
@@ -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;
 }
 
index ddbc3837e66084651896e64c851d0e3610e0008c..482cbb1e024f7f9556624083c021380ee67be557 100644 (file)
@@ -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;
 }
index e2326cbc9d0c2b38f1476d9698a6ca885e75e745..c879c40e57e43f99f903b40dd3b75d08894d8630 100644 (file)
@@ -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,
index cf20fe90a8096148281f84c166efbe9f13426809..07e4f49afa28e44c9d2def594270d1833c67bea8 100644 (file)
@@ -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;
index 0cc248d060abcec0cdbd4751d63c50f97e194159..1f3c288e0976230519ecf2e372b94fc82aad5cdb 100644 (file)
@@ -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,
index c050f5f85e59d19f0a3fcad00d522d569a0361fd..4b23eb1ed436552b575cfae39586f016b3f053fd 100644 (file)
@@ -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;
index aa7fa82ecf2336e2e23938607e6b1c38ae8ad9b7..27ee8ff219ae1b67162efd50cfc46ee1fbee24cf 100644 (file)
@@ -152,6 +152,7 @@ Video Effects
                Delay Video
                Freeze Frame
                Loop video
+               Interpolate Video
                ReframeRT
                Reverse video
                Time Average