diff --git a/olive.pro.user b/olive.pro.user index d30bf48be..9cd841866 100644 --- a/olive.pro.user +++ b/olive.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/panels/timeline.cpp b/panels/timeline.cpp index e8d30a610..627b3a7bb 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -468,7 +468,39 @@ void Timeline::split_clip_and_relink(Clip* clip, long frame, bool relink) { } } +void Timeline::clean_up_selections(QVector& areas) { + for (int i=0;i ss.out) { + // do nothing + } else if (s.in >= ss.in && s.out <= ss.out) { + remove = true; + } else if (s.in <= ss.out && s.out > ss.out) { + ss.out = s.out; + remove = true; + } else if (s.out >= ss.in && s.in < ss.in) { + ss.in = s.in; + remove = true; + } + if (remove) { + areas.removeAt(i); + i--; + break; + } + } + } + } + } +} + void Timeline::delete_areas_and_relink(QVector& areas) { + clean_up_selections(areas); + QVector pre_clips; QVector post_clips; diff --git a/panels/timeline.h b/panels/timeline.h index 142b7d1e2..0f7050d06 100644 --- a/panels/timeline.h +++ b/panels/timeline.h @@ -68,6 +68,7 @@ public: bool split_selection(); void split_at_playhead(); void split_clip_and_relink(Clip* clip, long frame, bool relink); + void clean_up_selections(QVector& areas); void delete_areas_and_relink(QVector& areas); void relink_clips_using_ids(QVector& old_clips, QVector& new_clips); void update_sequence(); diff --git a/project/sequence.cpp b/project/sequence.cpp index 32affc9e9..b1efd1abe 100644 --- a/project/sequence.cpp +++ b/project/sequence.cpp @@ -111,9 +111,11 @@ void Sequence::undo_add_current() { QVector* copied_clips = new QVector(); for (int i=0;icopy(); - copy->linked = original->linked; - copied_clips->append(copy); + if (original != NULL) { + Clip* copy = original->copy(); + copy->linked = original->linked; + copied_clips->append(copy); + } } undo_stack.append(copied_clips); } diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 47404fed6..2e9de8c66 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -349,35 +349,8 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { panel_timeline->redraw_all_clips(true); } else if (panel_timeline->selecting) { // remove duplicate selections - for (int i=0;iselections.size();i++) { - Selection& s = panel_timeline->selections[i]; - for (int j=0;jselections.size();j++) { - if (i != j) { - Selection& ss = panel_timeline->selections[j]; - if (s.track == ss.track) { - bool remove = false; - if (s.in < ss.in && s.out > ss.out) { - // do nothing - } else if (s.in >= ss.in && s.out <= ss.out) { - remove = true; - } else if (s.in <= ss.out && s.out > ss.out) { - ss.out = s.out; - remove = true; - } else if (s.out >= ss.in && s.in < ss.in) { - ss.in = s.in; - remove = true; - } - if (remove) { - panel_timeline->selections.removeAt(i); - i--; - repaint = true; - break; - } - } - } - } - } - + panel_timeline->clean_up_selections(panel_timeline->selections); + repaint = true; } // destroy all ghosts