fixed another overhaul crash

This commit is contained in:
itsmattkc
2018-09-18 21:27:28 +10:00
parent 1793c7837c
commit a267693213
3 changed files with 63 additions and 49 deletions
+51
View File
@@ -313,6 +313,8 @@ void Timeline::redraw_all_clips(bool changed) {
}
panel_viewer->update_end_timecode();
update_effect_controls();
}
void Timeline::select_all() {
@@ -332,6 +334,55 @@ void Timeline::select_all() {
}
}
void Timeline::update_effect_controls() {
// SEND CLIPS TO EFFECT CONTROLS
// find out how many clips are selected
// limits to one video clip and one audio clip and only if they're linked
// one of these days it might be nice to have multiple clips in the effects panel
panel_effect_controls->multiple = false;
int vclip = -1;
int aclip = -1;
QVector<int> selected_clips;
if (sequence != NULL) {
for (int i=0;i<sequence->clips.size();i++) {
Clip* clip = sequence->clips.at(i);
if (clip != NULL && panel_timeline->is_clip_selected(clip, true)) {
if (clip->track < 0 && vclip == -1) {
vclip = i;
} else if (clip->track >= 0 && aclip == -1) {
aclip = i;
} else {
vclip = -2;
aclip = -2;
panel_effect_controls->multiple = true;
break;
}
}
}
// check if aclip is linked to vclip
if (!panel_effect_controls->multiple) {
if (vclip >= 0) selected_clips.append(vclip);
if (aclip >= 0) selected_clips.append(aclip);
if (vclip >= 0 && aclip >= 0) {
bool found = false;
Clip* vclip_ref = sequence->clips.at(vclip);
for (int i=0;i<vclip_ref->linked.size();i++) {
if (vclip_ref->linked.at(i) == aclip) {
found = true;
break;
}
}
if (!found) {
// only display multiple clips if they're linked
selected_clips.clear();
panel_effect_controls->multiple = true;
}
}
}
}
panel_effect_controls->set_clips(selected_clips);
}
void Timeline::delete_in_out(bool ripple) {
if (sequence != NULL && sequence->using_workarea) {
QVector<Selection> areas;
+2 -1
View File
@@ -107,10 +107,10 @@ public:
void set_out_point();
void delete_in_out(bool ripple);
int get_snap_range();
int getTimelineScreenPointFromFrame(long frame);
long getTimelineFrameFromScreenPoint(int x);
int get_snap_range();
bool snap_to_point(long point, long* l);
void snap_to_clip(long* l, bool playhead_inclusive);
@@ -140,6 +140,7 @@ public:
long drag_frame_start;
int drag_track_start;
void redraw_all_clips(bool changed);
void update_effect_controls();
QVector<int> video_track_heights;
QVector<int> audio_track_heights;
+10 -48
View File
@@ -542,6 +542,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
bool repaint = false;
bool redraw = false;
if (panel_timeline->creating) {
if (panel_timeline->ghosts.size() > 0) {
@@ -611,7 +612,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
undo_stack.push(ca);
panel_timeline->redraw_all_clips(true);
redraw = true;
if (!shift) {
panel_timeline->creating = false;
@@ -788,8 +789,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
undo_stack.push(ca);
panel_timeline->redraw_all_clips(true);
repaint = false;
redraw = true;
}
} else if (panel_timeline->selecting || panel_timeline->rect_select_proc) {
repaint = true;
@@ -804,7 +804,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
}
if (split) {
undo_stack.push(ca);
panel_timeline->redraw_all_clips(true);
redraw = true;
} else {
delete ca;
}
@@ -830,52 +830,14 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
pre_clips.clear();
post_clips.clear();
if (repaint) panel_timeline->repaint_timeline();
// SEND CLIPS TO EFFECT CONTROLS
// find out how many clips are selected
// limits to one video clip and one audio clip and only if they're linked
// one of these days it might be nice to have multiple clips in the effects panel
panel_effect_controls->multiple = false;
int vclip = -1;
int aclip = -1;
for (int i=0;i<sequence->clips.size();i++) {
Clip* clip = sequence->clips.at(i);
if (clip != NULL && panel_timeline->is_clip_selected(clip, true)) {
if (clip->track < 0 && vclip == -1) {
vclip = i;
} else if (clip->track >= 0 && aclip == -1) {
aclip = i;
} else {
vclip = -2;
aclip = -2;
panel_effect_controls->multiple = true;
break;
}
}
}
// check if aclip is linked to vclip
QVector<int> selected_clips;
if (!panel_effect_controls->multiple) {
if (vclip >= 0) selected_clips.append(vclip);
if (aclip >= 0) selected_clips.append(aclip);
if (vclip >= 0 && aclip >= 0) {
bool found = false;
Clip* vclip_ref = sequence->clips.at(vclip);
for (int i=0;i<vclip_ref->linked.size();i++) {
if (vclip_ref->linked.at(i) == aclip) {
found = true;
break;
}
}
if (!found) {
// only display multiple clips if they're linked
selected_clips.clear();
panel_effect_controls->multiple = true;
}
if (redraw) {
panel_timeline->redraw_all_clips(true);
} else {
if (repaint) {
panel_timeline->repaint_timeline();
}
panel_timeline->update_effect_controls();
}
panel_effect_controls->set_clips(selected_clips);
}
}
}