diff --git a/timeline/clip.cpp b/timeline/clip.cpp index 2d15bc18b..78ad4f74a 100644 --- a/timeline/clip.cpp +++ b/timeline/clip.cpp @@ -706,8 +706,6 @@ bool Clip::Retrieve() texture_timestamp = frame->pts; - //} - ret = true; } else { qCritical() << "Failed to retrieve frame for clip" << name(); diff --git a/timeline/track.cpp b/timeline/track.cpp index 7778d10b7..740f7a1e0 100644 --- a/timeline/track.cpp +++ b/timeline/track.cpp @@ -261,11 +261,12 @@ bool Track::IsTransitionSelected(Transition *t) void Track::SelectArea(long in, long out) { selections_.append(Selection(in, out, this)); + Selection::Tidy(selections_); } void Track::SelectClip(Clip* c) { - selections_.append(Selection(c->timeline_in(), c->timeline_out(), this)); + SelectArea(c->timeline_in(), c->timeline_out()); } void Track::SelectAll() diff --git a/ui/timelineview.cpp b/ui/timelineview.cpp index f78c02fda..73a2ba77c 100644 --- a/ui/timelineview.cpp +++ b/ui/timelineview.cpp @@ -2399,39 +2399,45 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event) { long frame_min = qMin(ParentTimeline()->drag_frame_start, ParentTimeline()->cursor_frame); long frame_max = qMax(ParentTimeline()->drag_frame_start, ParentTimeline()->cursor_frame); - int track_min = qMin(ParentTimeline()->drag_track_start->Index(), ParentTimeline()->cursor_track->Index()); - int track_max = qMax(ParentTimeline()->drag_track_start->Index(), ParentTimeline()->cursor_track->Index()); - // determine which clips are in this rectangular selection QVector selected_clips; for (int j=0;jTrackCount();j++) { Track* track = track_list_->TrackAt(j); - for (int i=0;iClipCount();i++) { - Clip* clip = track->GetClip(i).get(); - if (clip->track()->Index() >= track_min && - clip->track()->Index() <= track_max && - !(clip->timeline_in() < frame_min && clip->timeline_out() < frame_min) && - !(clip->timeline_in() > frame_max && clip->timeline_out() > frame_max)) { + int track_top = getScreenPointFromTrack(track); + int track_bottom = track_top + track->height(); + int rect_top = qMin(ParentTimeline()->rect_select_rect.top(), ParentTimeline()->rect_select_rect.bottom()); + int rect_bottom = qMax(ParentTimeline()->rect_select_rect.top(), ParentTimeline()->rect_select_rect.bottom()); - // create a group of the clip (and its links if alt is not pressed) - QVector session_clips; - session_clips.append(clip); + // See if this track touches this rectangle at all + if (!(track_bottom < rect_top + || track_top > rect_bottom)) { - if (!alt) { - session_clips.append(clip->linked); - } + // Loop through track's clips for clips touching this rectangle + for (int i=0;iClipCount();i++) { + Clip* clip = track->GetClip(i).get(); + if (!(clip->timeline_out() < frame_min || clip->timeline_in() > frame_max) ) { - // for each of these clips, see if clip has already been added - - // this can easily happen due to adding linked clips - for (int j=0;j session_clips; + session_clips.append(clip); - if (!selected_clips.contains(c)) { - selected_clips.append(c); + if (!alt) { + session_clips.append(clip->linked); + } + + // for each of these clips, see if clip has already been added - + // this can easily happen due to adding linked clips + for (int j=0;jTrackCount();i++) { - int i = 0; - while (true) { + for (int i=0;iTrackCount();i++) { +// int i = 0; +// while (true) { int new_heights = heights + 1; @@ -3337,8 +3343,10 @@ Track *TimelineView::getTrackFromScreenPoint(int y) { heights = new_heights; - i++; +// i++; } + + return nullptr; } int TimelineView::getScreenPointFromTrack(Track *track) {