From 22264cebcd815d9bdc30b905a476a0d1e8c9c3ef Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 30 Dec 2018 21:58:49 +1100 Subject: [PATCH] fixed some weird ripple edit code --- ui/timelinewidget.cpp | 53 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 109a1d2fe..3e517a01f 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -1817,47 +1817,38 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { // ripple edit prep if (panel_timeline->tool == TIMELINE_TOOL_RIPPLE) { - QVector axis_ghosts; + long axis = LONG_MAX; + for (int i=0;ighosts.size();i++) { Clip* c = sequence->clips.at(panel_timeline->ghosts.at(i).clip); - bool found = false; - for (int j=0;jtrack == cc->track && - ((panel_timeline->trim_in_point && c->timeline_in < cc->timeline_in) || - (!panel_timeline->trim_in_point && c->timeline_out > cc->timeline_out))) { - axis_ghosts[j] = c; - found = true; - break; - } - } - if (!found) { - axis_ghosts.append(c); + if (panel_timeline->trim_in_point) { + axis = qMin(axis, c->timeline_in); + } else { + axis = qMin(axis, c->timeline_out); } } for (int i=0;iclips.size();i++) { Clip* c = sequence->clips.at(i); if (c != NULL && !panel_timeline->is_clip_selected(c, true)) { - for (int j=0;jtrim_in_point) ? axis->timeline_in : axis->timeline_out; - bool clip_is_pre = (c->timeline_in < comp_point); - QVector& clip_list = clip_is_pre ? pre_clips : post_clips; - bool found = false; - for (int k=0;ktrack == c->track) { - if (clip_is_pre == (c->timeline_in > cached->timeline_in)) { - clip_list[k] = c; - } - found = true; - break; + bool clip_is_post = (c->timeline_in >= axis); + + // see if this a clip on this track is already in the list, and if it's closer + bool found = false; + QVector& clip_list = clip_is_post ? post_clips : pre_clips; + for (int j=0;jtrack == c->track) { + if ((panel_timeline->trim_in_point && compare->timeline_out < c->timeline_out) + || (!panel_timeline->trim_in_point && compare->timeline_in > c->timeline_in)) { + clip_list[j] = c; } + found = true; + break; } - if (!found) { - clip_list.append(c); - } + } + if (!found) { + clip_list.append(c); } } }