This commit is contained in:
itsmattkc
2018-07-01 02:08:05 +01:00
parent 791cc6618b
commit 7a3651d5a4
5 changed files with 41 additions and 33 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.6.2, 2018-06-30T19:57:23. -->
<!-- Written by QtCreator 4.6.2, 2018-06-30T21:54:35. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
+32
View File
@@ -468,7 +468,39 @@ void Timeline::split_clip_and_relink(Clip* clip, long frame, bool relink) {
}
}
void Timeline::clean_up_selections(QVector<Selection>& areas) {
for (int i=0;i<areas.size();i++) {
Selection& s = areas[i];
for (int j=0;j<areas.size();j++) {
if (i != j) {
Selection& ss = areas[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) {
areas.removeAt(i);
i--;
break;
}
}
}
}
}
}
void Timeline::delete_areas_and_relink(QVector<Selection>& areas) {
clean_up_selections(areas);
QVector<Clip*> pre_clips;
QVector<Clip*> post_clips;
+1
View File
@@ -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<Selection>& areas);
void delete_areas_and_relink(QVector<Selection>& areas);
void relink_clips_using_ids(QVector<Clip*>& old_clips, QVector<Clip*>& new_clips);
void update_sequence();
+5 -3
View File
@@ -111,9 +111,11 @@ void Sequence::undo_add_current() {
QVector<Clip*>* copied_clips = new QVector<Clip*>();
for (int i=0;i<clip_count();i++) {
Clip* original = get_clip(i);
Clip* copy = original->copy();
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);
}
+2 -29
View File
@@ -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;i<panel_timeline->selections.size();i++) {
Selection& s = panel_timeline->selections[i];
for (int j=0;j<panel_timeline->selections.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