drag+drop honours labels/plugins/autos, new drag icon, phantom keyframe fix
authorGood Guy <good1.2guy@gmail.com>
Thu, 27 Dec 2018 21:10:42 +0000 (14:10 -0700)
committerGood Guy <good1.2guy@gmail.com>
Thu, 27 Dec 2018 21:10:42 +0000 (14:10 -0700)
20 files changed:
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edit.h
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/edl.h
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/plugin.C
cinelerra-5.1/cinelerra/plugin.h
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/track.h
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/tracksedit.C
cinelerra-5.1/plugins/theme_blond/data/clip_icon.png
cinelerra-5.1/plugins/theme_blond_cv/data/clip_icon.png
cinelerra-5.1/plugins/theme_blue/data/clip_icon.png
cinelerra-5.1/plugins/theme_hulk/data/clip_icon.png
cinelerra-5.1/plugins/theme_pinklady/data/clip_icon.png
cinelerra-5.1/plugins/theme_suv/data/clip_icon.png
cinelerra-5.1/plugins/theme_unflat/data/clip_icon.png

index 40e7151..20e8b93 100644 (file)
@@ -242,15 +242,6 @@ int Edit::silence()
                asset || nested_edl :
                *((SEdit *)this)->get_text()) ? 0 : 1;
 }
-void Edit::mute()
-{
-       if( track->data_type != TRACK_SUBTITLE ) {
-               asset = 0;
-               nested_edl = 0;
-       }
-       else
-               *((SEdit *)this)->get_text() = 0;
-}
 
 void Edit::set_selected(int v)
 {
index ffdd0fe..ff045fd 100644 (file)
@@ -114,7 +114,6 @@ public:
        void detach_transition();
 // Determine if silence depending on existance of asset or plugin title
        virtual int silence();
-       void mute();
        void set_selected(int v);
 
 // Media edit information
index 765d657..a38bef5 100644 (file)
@@ -646,8 +646,7 @@ void Edits::clear_recursive(int64_t start, int64_t end,
 {
 //printf("Edits::clear_recursive 1\n");
        track->clear(start, end,
-               edit_edits, edit_labels, edit_plugins, edit_autos, 0,
-               trim_edits);
+               edit_edits, edit_labels, edit_plugins, edit_autos, trim_edits);
 }
 
 
index 1c0c77b..5f23b1b 100644 (file)
@@ -794,6 +794,103 @@ int EDL::clear(double start, double end,
        return 0;
 }
 
+void EDL::delete_edits(ArrayList<Edit*> *edits, int collapse)
+{
+       if( session->labels_follow_edits )
+               delete_edit_labels(edits, collapse);
+       for( int i=0; i<edits->size(); ++i ) {
+               Edit *edit = edits->get(i);
+               Track *track = edit->track;
+               int64_t start = edit->startproject;
+               int end = start + edit->length;
+               track->clear(start, end, 1, 0,
+                       session->plugins_follow_edits,
+                       session->autos_follow_edits, 0);
+               if( !collapse )
+                       track->paste_silence(start, end,
+                               session->plugins_follow_edits,
+                               session->autos_follow_edits);
+       }
+       optimize();
+}
+
+class Range {
+public:
+       static int cmp(Range *ap, Range *bp);
+       double start, end;
+       bool operator ==(Range &that) { return this->start == that.start; }
+       bool operator >(Range &that) { return this->start > that.start; }
+};
+int Range::cmp(Range *ap, Range *bp) {
+       return ap->start < bp->start ? -1 : ap->start == bp->start ? 0 : 1;
+}
+
+static void get_edit_regions(ArrayList<Edit*> *edits, ArrayList<Range> &regions)
+{
+// move edit inclusive labels by regions
+       for( int i=0; i<edits->size(); ++i ) {
+               Edit *edit = edits->get(i);
+               double pos = edit->track->from_units(edit->startproject);
+               double end = edit->track->from_units(edit->startproject + edit->length);
+               int n = regions.size(), k = n;
+               while( --k >= 0 ) {
+                       Range &range = regions[k];
+                       if( pos >= range.end ) continue;
+                       if( range.start >= end ) continue;
+                       int expand = 0;
+                       if( range.start > pos ) { range.start = pos;  expand = 1; }
+                       if( range.end < end ) { range.end = end;  expand = 1; }
+                       if( !expand ) break;
+                       k = n;
+               }
+               if( k < 0 ) {
+                       Range &range = regions.append();
+                       range.start = pos;  range.end = end;
+               }
+       }
+       regions.sort(Range::cmp);
+}
+
+void EDL::delete_edit_labels(ArrayList<Edit*> *edits, int collapse)
+{
+       ArrayList<Range> regions;
+       get_edit_regions(edits, regions);
+       int n = regions.size(), k = n;
+       while( --k >= 0 ) {
+               Range &range = regions[k];
+               labels->clear(range.start, range.end, collapse);
+       }
+}
+
+void EDL::move_edit_labels(ArrayList<Edit*> *edits, double dist)
+{
+       ArrayList<Range> regions;
+       get_edit_regions(edits, regions);
+       int n = regions.size(), k = n;
+       Labels moved(this, 0);
+       while( --k >= 0 ) {
+               Range &range = regions[k];
+               Label *label = labels->label_of(range.start);
+               for( Label *next=0; label && label->position <= range.end; label=next ) {
+                       next = label->next;
+                       labels->remove_pointer(label);
+                       label->position += dist;
+                       moved.append(label);
+               }
+               Label *current = labels->first;
+               while( (label=moved.first) ) {
+                       moved.remove_pointer(label);
+                       while( current && current->position < label->position )
+                               current = current->next;
+                       if( current && current->position == label->position ) {
+                               delete label;  continue;
+                       }
+                       labels->insert_before(current, label);
+               }
+       }
+}
+
+
 void EDL::modify_edithandles(double oldposition,
        double newposition,
        int currentend,
index 2cd5de8..6ec34c8 100644 (file)
@@ -168,6 +168,9 @@ public:
        const char *get_folder_name(int no);
        int new_folder(const char *title, int is_clips);
        int delete_folder(const char *title);
+       void delete_edits(ArrayList<Edit*>*, int);
+       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,
index bb02ba7..e11d339 100644 (file)
@@ -182,7 +182,9 @@ public:
        void update_vwindow();
 // Fit selected time to horizontal display range
        void fit_selection();
-       EDL *selected_edits_to_clip(int packed, double *start_position=0, Track **start_track=0);
+       EDL *selected_edits_to_clip(int packed,
+               double *start_position, Track **start_track,
+               int edit_labels, int edit_autos, int edit_plugins);
        void selected_edits_to_clipboard(int packed);
 // Fit selected autos to the vertical display range
        void fit_autos(int doall);
@@ -403,7 +405,7 @@ public:
        void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
 // 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
                int behaviour);
-       void move_group(EDL *group, Track *first_track, double position, int overwrite);
+       void move_group(EDL *group, Track *first_track, double position);
 // Move effect to position
        void move_effect(Plugin *plugin, Track *track, int64_t position);
        void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
index b38a563..a1e3d43 100644 (file)
@@ -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"
@@ -903,7 +904,9 @@ void MWindow::match_output_size(Track *track)
 }
 
 
-EDL *MWindow::selected_edits_to_clip(int packed, double *start_position, Track **start_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;
@@ -945,28 +948,123 @@ EDL *MWindow::selected_edits_to_clip(int packed, double *start_position, Track *
                int64_t start_pos = track->to_units(start, 0);
                int64_t end_pos = track->to_units(end, 0);
                int64_t startproject = 0;
-               for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+               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;
-                       if( !edit->is_selected || edit->silence() ) continue;
+                       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);
-                       if( new_track ) {
-                               if( !packed ) {
-                                       int64_t edit_position = edit->startproject - start_pos;
-                                       if( edit_position > startproject ) {
-                                               Edit *silence = new Edit(new_edl, new_track);
-                                               silence->startproject = startproject;
-                                               silence->length = edit_position - startproject;
-                                               new_track->edits->append(silence);
-                                               startproject = edit_position;
+                       int64_t edit_pos = edit_start_pos - start_pos;
+                       if( !packed ) {
+                               if( 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->position<clip_position )
+                                               clip_label = clip_label->next;
+                                       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; i<AUTOMATION_TOTAL; ++i ) {
+                                       Autos *autos = automation->autos[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; i<track->plugin_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 = 0;
+                                       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( 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 = startplugin;
+                                               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 clip_position = keyframe->position - start_pos;
+                                                       clip_keyframe->position = clip_position;
+                                                       new_keyframes->append(clip_keyframe);
+                                               }
                                        }
                                }
-                               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( last_track == track ) break;
@@ -976,7 +1074,10 @@ EDL *MWindow::selected_edits_to_clip(int packed, double *start_position, Track *
 
 void MWindow::selected_edits_to_clipboard(int packed)
 {
-       EDL *new_edl = MWindow::selected_edits_to_clip(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;
@@ -999,18 +1100,7 @@ void MWindow::delete_edits(ArrayList<Edit*> *edits, const char *msg, int collaps
 {
        if( !edits->size() ) return;
        undo->update_undo_before();
-       for( Track *track=edl->tracks->first; track; track=track->next ) {
-               for( Edit *next=track->edits->first; next; ) {
-                       Edit *edit = next;  next = edit->next;
-                       if( !edit->is_selected ) continue;
-                       int64_t len = edit->length;
-                       delete edit;
-                       if( !collapse ) continue;
-                       for( edit=next; edit; edit=edit->next )
-                               edit->startproject -= len;
-               }
-       }
-       edl->optimize();
+       edl->delete_edits(edits, collapse);
        save_backup();
        undo->update_undo_after(msg, LOAD_EDITS);
 
@@ -1063,10 +1153,94 @@ void MWindow::move_edits(ArrayList<Edit*> *edits,
        gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
 }
 
-void MWindow::move_group(EDL *group, Track *first_track, double position, int overwrite)
+void MWindow::move_group(EDL *group, Track *first_track, double position)
 {
        undo->update_undo_before();
-       edl->tracks->move_group(group, first_track, position, overwrite);
+       if( edl->session->labels_follow_edits ) {
+               ArrayList<Edit *>edits;
+               edl->tracks->get_selected_edits(&edits);
+               double dist = position - session->drag_group_position;
+               edl->move_edit_labels(&edits, dist);
+       }
+       for( Track *track=edl->tracks->first; track; track=track->next ) {
+               if( !track->record ) continue;
+               Edit *edit = track->edits->first;
+               for( Edit *next=0; edit; edit=next ) {
+                       next = edit->next;
+                       if( !edit->is_selected ) continue;
+                       edit->is_selected = 0;
+                       edit->group_id = 0;
+                       int64_t start = edit->startproject;
+                       int64_t end = start + edit->length;
+                       track->clear(start, end, 1, 0,
+                               edl->session->plugins_follow_edits,
+                               edl->session->autos_follow_edits, 0);
+                       track->paste_silence(start, end,
+                               edl->session->plugins_follow_edits,
+                                       edl->session->autos_follow_edits);
+                       next = track->edits->first;
+               }
+       }
+       Track *src = group->tracks->first;
+       for( Track *track=first_track; track && src; track=track->next ) {
+               if( !track->record ) continue;
+               int64_t pos = track->to_units(position, 0);
+               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;
+                       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( edl->session->autos_follow_edits ) {
+                       for( int i=0; i<AUTOMATION_TOTAL; ++i ) {
+                               Autos *src_autos = src->automation->autos[i];
+                               if( !src_autos ) continue;
+                               Autos *autos = track->automation->autos[i];
+                               for( Auto *aut0=src_autos->first; aut0; aut0=aut0->next ) {
+                                       int64_t position = pos + aut0->position;
+                                       autos->insert_auto(position, aut0);
+                               }
+                       }
+               }
+               if( edl->session->plugins_follow_edits ) {
+                       for( int i=0; i<src->plugin_set.size(); ++i ) {
+                               PluginSet *plugin_set = src->plugin_set[i];
+                               if( !plugin_set ) continue;
+                               while( track->plugin_set.size() < i )
+                                       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;
+                               for( ; plugin; plugin=(Plugin *)plugin->next ) {
+                                       int64_t start = pos + plugin->startproject;
+                                       int64_t end = start + plugin->length;
+                                       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 position = pos + keyframe->position;
+                                               dst->keyframes->insert_auto(position, keyframe);
+                                       }
+                               }
+                       }
+               }
+               track->optimize();
+               src = src->next;
+       }
+       edl->tracks->clear_selected_edits();
+
        save_backup();
        undo->update_undo_after(_("move group"), LOAD_ALL);
        restart_brender();
@@ -1674,7 +1848,6 @@ int MWindow::paste_edls(ArrayList<EDL*> *new_edls, int load_mode,
                                                        current_position + length,
                                                        1, // edit edits
                                                        edit_labels, edit_plugins, edit_autos,
-                                                       1, // convert units
                                                        0); // trim edits
                                        }
 //PRINT_TRACE
index 2502319..b4c8e44 100644 (file)
@@ -100,10 +100,7 @@ int Plugin::operator==(Edit& that)
 
 int Plugin::silence()
 {
-       if(plugin_type != PLUGIN_NONE)
-               return 0;
-       else
-               return 1;
+       return plugin_type == PLUGIN_NONE ? 1 : 0;
 }
 
 void Plugin::clear_keyframes(int64_t start, int64_t end)
@@ -112,7 +109,7 @@ void Plugin::clear_keyframes(int64_t start, int64_t end)
 }
 
 
-void Plugin::copy_from(Edit *edit)
+void Plugin::copy_base(Edit *edit)
 {
        Plugin *plugin = (Plugin*)edit;
 
@@ -129,8 +126,12 @@ void Plugin::copy_from(Edit *edit)
 // Should reconfigure this based on where the first track is now.
        this->shared_location = plugin->shared_location;
        strcpy(this->title, plugin->title);
+}
 
-       copy_keyframes(plugin);
+void Plugin::copy_from(Edit *edit)
+{
+       copy_base(edit);
+       copy_keyframes((Plugin*)edit);
 }
 
 void Plugin::copy_keyframes(Plugin *plugin)
index 15aa75c..220066c 100644 (file)
@@ -74,6 +74,7 @@ public:
        virtual int operator==(Plugin& that);
        virtual int operator==(Edit& that);
 
+       void copy_base(Edit *edit);
        virtual void copy_from(Edit *edit);
 
 
index 4afeeab..ddbc383 100644 (file)
@@ -1178,32 +1178,27 @@ int Track::blade(double position)
 
 int Track::clear(double start, double end,
        int edit_edits, int edit_labels, int edit_plugins,
-       int edit_autos, int convert_units, Edits *trim_edits)
+       int edit_autos, Edits *trim_edits)
 {
-// Edits::move_auto calls this routine after the units are converted to the track
-// format.
-//printf("Track::clear 1 %d %d %d\n", edit_edits, edit_labels, edit_plugins);
-       if(convert_units)
-       {
-               start = to_units(start, 0);
-               end = to_units(end, 1);
-       }
-
-
-       if(edit_autos)
-               automation->clear((int64_t)start, (int64_t)end, 0, 1);
+       return clear(to_units(start, 0), to_units(end, 1),
+               edit_edits, edit_labels, edit_plugins, edit_autos, trim_edits);
+}
 
-       if(edit_plugins)
-       {
-               for(int i = 0; i < plugin_set.total; i++)
-               {
+int Track::clear(int64_t start, int64_t end,
+       int edit_edits, int edit_labels, int edit_plugins,
+       int edit_autos, Edits *trim_edits)
+{
+//printf("Track::clear 1 %d %d %d\n", edit_edits, edit_labels, edit_plugins);
+       if( edit_autos )
+               automation->clear(start, end, 0, 1);
+       if( edit_plugins ) {
+               for(int i = 0; i < plugin_set.total; i++) {
                        if(!trim_edits || trim_edits == (Edits*)plugin_set.values[i])
-                               plugin_set.values[i]->clear((int64_t)start, (int64_t)end, edit_autos);
+                               plugin_set.values[i]->clear(start, end, edit_autos);
                }
        }
-
-       if(edit_edits)
-               edits->clear((int64_t)start, (int64_t)end);
+       if( edit_edits )
+               edits->clear(start, end);
        return 0;
 }
 
@@ -1275,13 +1270,17 @@ int Track::modify_pluginhandles(double oldposition,
 
 int Track::paste_silence(double start, double end, int edit_plugins, int edit_autos)
 {
-       int64_t start_i = to_units(start, 0);
-       int64_t end_i = to_units(end, 1);
-
-       edits->paste_silence(start_i, end_i);
-       if(edit_autos) shift_keyframes(start_i, end_i - start_i);
-       if(edit_plugins) shift_effects(start_i, end_i - start_i, edit_autos);
+       return paste_silence(to_units(start, 0), to_units(end, 1),
+                       edit_plugins, edit_autos);
+}
 
+int Track::paste_silence(int64_t start, int64_t end, int edit_plugins, int edit_autos)
+{
+       edits->paste_silence(start, end);
+       if( edit_autos )
+               shift_keyframes(start, end - start);
+       if( edit_plugins )
+               shift_effects(start, end - start, edit_autos);
        edits->optimize();
        return 0;
 }
index bb1081e..e2326cb 100644 (file)
@@ -204,7 +204,10 @@ public:
        int blade(double position);
        int clear(double start, double end,
                int edit_edits, int edit_labels, int clear_plugins,
-               int edit_autos, int convert_units, Edits *trim_edits);
+               int edit_autos, Edits *trim_edits);
+       int clear(int64_t start, int64_t end,
+               int edit_edits, int edit_labels, int clear_plugins,
+               int edit_autos, Edits *trim_edits);
 // Returns the point to restart background rendering at.
 // -1 means nothing changed.
        void clear_automation(double selectionstart, double selectionend,
@@ -238,6 +241,7 @@ public:
                int clear_labels, int clear_plugins, int edit_autos,
                double &distance);
        int paste_silence(double start, double end, int edit_plugins, int edit_autos);
+       int paste_silence(int64_t start, int64_t end, int edit_plugins, int edit_autos);
        virtual int select_translation(int cursor_x, int cursor_y) { return 0; };  // select video coordinates for frame
        virtual int update_translation(int cursor_x, int cursor_y, int shift_down) { return 0; };  // move video coordinates
        int select_auto(AutoConf *auto_conf, int cursor_x, int cursor_y);
index e241b4d..72c9d00 100644 (file)
@@ -194,7 +194,7 @@ int TrackCanvas::drag_motion(
                drag_cursor_motion(cursor_x, cursor_y,
                        over_track, over_edit, over_pluginset, over_plugin);
        }
-        if( over_track && !*over_track )
+       if( over_track && !*over_track )
                *over_track = pane->over_patchbay();
        return 0;
 }
@@ -524,7 +524,7 @@ int TrackCanvas::drag_stop(int *redraw)
                                                ret = test_track_group(drag_group, drop_track, new_pos);
                                        }
                                        if( ret )
-                                               mwindow->move_group(drag_group, drop_track, new_pos, 1);
+                                               mwindow->move_group(drag_group, drop_track, new_pos);
                                        drag_group->remove_user();
                                        mwindow->session->drag_group = 0;
                                }
@@ -2284,7 +2284,7 @@ void TrackCanvas::draw_keyframe_reticle()
                mwindow->session->drag_auto->autos->autoidx : -1;
 
        if( get_buttonpress() == LEFT_BUTTON && dragging &&
-            keyframe_hairline == HAIRLINE_DRAGGING ) {
+           keyframe_hairline == HAIRLINE_DRAGGING ) {
                draw_hairline(mwindow->session->drag_auto, RED, 1);
                return;
        }
@@ -3571,6 +3571,9 @@ int TrackCanvas::draw_hairline(Auto *auto_keyframe, int color, int show)
 
        calculate_viewport(track, view_start, unit_start, view_end, unit_end,
                        yscale, center_pixel, zoom_sample, zoom_units);
+       if( auto_keyframe->position < unit_start ||
+           auto_keyframe->position >= unit_end )
+               return 0;
 
        double ax = 0, ay = 0;
        calculate_auto_position(&ax, &ay, 0, 0, 0, 0,
@@ -4909,7 +4912,10 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                                double start_position = 0;
                                                mwindow->session->drag_group =
                                                        mwindow->selected_edits_to_clip(0, &start_position,
-                                                               &mwindow->session->drag_group_first_track);
+                                                               &mwindow->session->drag_group_first_track,
+                                                               mwindow->edl->session->labels_follow_edits,
+                                                               mwindow->edl->session->autos_follow_edits,
+                                                               mwindow->edl->session->plugins_follow_edits);
                                                if( mwindow->session->drag_group ) {
                                                        mwindow->session->current_operation = DRAG_GROUP;
                                                        mwindow->session->drag_group_position = start_position;
@@ -5359,7 +5365,7 @@ void TrackCanvas::show_message(Auto *current, int show_curve_type, const char *f
        va_list ap;
        va_start(ap, fmt);
        vsnprintf(cp, ep-cp, fmt, ap);
-        va_end(ap);
+       va_end(ap);
        gui->show_message(string);
 }
 
index d97800c..c050f5f 100644 (file)
@@ -72,7 +72,6 @@ int Tracks::clear(double start, double end, int clear_plugins, int edit_autos)
                                1, // labels
                                clear_plugins, // edit_plugins
                                edit_autos,
-                               1, // convert_units
                                0); // trim_edits
                }
        }
@@ -741,39 +740,6 @@ void Tracks::move_edits(ArrayList<Edit*> *edits,
        }
 }
 
-void Tracks::move_group(EDL *group, Track *first_track, double position, int overwrite)
-{
-       for( Track *track=first; track; track=track->next ) {
-               if( !track->record ) continue;
-               for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
-                       if( !edit->is_selected ) continue;
-                       edit->mute();
-                       edit->is_selected = 0;
-                       edit->group_id = 0;
-               }
-       }
-       Track *src = group->tracks->first;
-       for( Track *track=first_track; track && src; track=track->next ) {
-               if( !track->record ) continue;
-               int64_t pos = track->to_units(position, 0);
-               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;
-               }
-               track->optimize();
-               src = src->next;
-       }
-}
-
 void Tracks::move_effect(Plugin *plugin, Track *track, int64_t position)
 {
        Track *source_track = plugin->track;
index a22851f..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_blond/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_blond/data/clip_icon.png differ
index e215ade..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_blond_cv/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_blond_cv/data/clip_icon.png differ
index bf69459..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_blue/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_blue/data/clip_icon.png differ
index eb8bd5e..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_hulk/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_hulk/data/clip_icon.png differ
index d201701..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_pinklady/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_pinklady/data/clip_icon.png differ
index ffd09f7..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_suv/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_suv/data/clip_icon.png differ
index 7122770..7eda379 100644 (file)
Binary files a/cinelerra-5.1/plugins/theme_unflat/data/clip_icon.png and b/cinelerra-5.1/plugins/theme_unflat/data/clip_icon.png differ