fix for selected_to_clipboard unpacked copy
authorGood Guy <good1.2guy@gmail.com>
Sat, 15 Dec 2018 03:39:36 +0000 (20:39 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sat, 15 Dec 2018 03:39:36 +0000 (20:39 -0700)
cinelerra-5.1/cinelerra/mwindowedit.C

index 1e1bd0cd06ce158bbbd5801000bdafde1a0e7aa1..03319cfc974cb509c4d7ef1bc75583f254f5f201 100644 (file)
@@ -939,28 +939,28 @@ void MWindow::selected_to_clipboard(int packed)
                Track *new_track = 0;
                if( !packed )
                        new_track = new_edl->add_new_track(track->data_type);
-               int64_t startproject = 0, last_startproject = start;
+               int64_t startproject = 0;
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
                        if( edit->startproject < start ) continue;
                        if( edit->startproject >= end ) break;
-                       if( !edit->is_selected || edit->silence() ) {
-                               if( !packed ) startproject += edit->length;
-                               continue;
-                       }
+                       if( !edit->is_selected || edit->silence() ) continue;
                        if( !new_track )
                                new_track = new_edl->add_new_track(track->data_type);
                        if( new_track ) {
-                               if( !packed && startproject > last_startproject ) {
-                                       Edit *silence = new Edit(new_edl, new_track);
-                                       silence->startproject = last_startproject;
-                                       silence->length = startproject - last_startproject;
-                                       new_track->edits->append(silence);
+                               if( !packed ) {
+                                       int64_t edit_position = edit->startproject - start;
+                                       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;
+                                       }
                                }
                                Edit *clip_edit = new Edit(new_edl, new_track);
                                clip_edit->copy_from(edit);
                                clip_edit->startproject = startproject;
                                startproject += clip_edit->length;
-                               last_startproject = startproject;
                                new_track->edits->append(clip_edit);
                        }
                }