Merge branch 'master' of https://github.com/olive-editor/olive into blendmodefix

This commit is contained in:
itsmattkc
2019-01-28 17:28:06 +11:00
11 changed files with 119 additions and 72 deletions
+21 -2
View File
@@ -22,6 +22,9 @@
#define SUBLINE_MIN_PADDING 50 // TODO play with this
#define MARKER_SIZE 4
// used only if center_timeline_timecodes is FALSE
#define TEXT_PADDING_FROM_LINE 4
bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead) {
// returns true is the scroll was changed, false if not
int target_scroll = qMin(bar->maximum(), qMax(0, getScreenPointFromFrame(zoom, playhead)-(bar->width()>>1)));
@@ -351,7 +354,16 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
timecode = frame_to_timecode(frame + in_visible, config.timecode_view, viewer->seq->frame_rate);
fullTextWidth = fm.width(timecode);
textWidth = fullTextWidth>>1;
text_x = lineX-textWidth;
text_x = lineX;
// centers the text to that point on the timeline, LEFT aligns it if not
if (config.center_timeline_timecodes) {
text_x -= textWidth;
} else {
text_x += TEXT_PADDING_FROM_LINE;
}
lastTextBoundary = lineX+textWidth;
if (lastTextBoundary >= 0) {
draw_text = true;
@@ -366,7 +378,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
// draw line markers
p.setPen(Qt::gray);
p.drawLine(lineX, yoff, lineX, height());
p.drawLine(lineX, (!config.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
// draw sub-line markers
for (int j=1;j<sublineCount;j++) {
@@ -443,6 +455,13 @@ void TimelineHeader::show_context_menu(const QPoint &pos) {
mainWindow->make_inout_menu(&menu);
menu.addSeparator();
QAction* center_timecodes = menu.addAction(tr("Center Timecodes"), mainWindow, SLOT(toggle_bool_action()));
center_timecodes->setCheckable(true);
center_timecodes->setChecked(config.center_timeline_timecodes);
center_timecodes->setData(reinterpret_cast<quintptr>(&config.center_timeline_timecodes));
menu.exec(mapToGlobal(pos));
}
+4 -39
View File
@@ -66,19 +66,6 @@ TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent) {
connect(&tooltip_timer, SIGNAL(timeout()), this, SLOT(tooltip_timer_timeout()));
}
void TimelineWidget::right_click_ripple() {
QVector<Selection> sels;
Selection s;
s.in = rc_ripple_min;
s.out = rc_ripple_max;
s.track = panel_timeline->cursor_track;
sels.append(s);
panel_timeline->delete_selection(sels, true);
}
void TimelineWidget::show_context_menu(const QPoint& pos) {
if (sequence != nullptr) {
// hack because sometimes right clicking doesn't trigger mouse release event
@@ -114,36 +101,14 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
if (selected_clips.isEmpty()) {
// no clips are selected
// determine if we can perform a ripple empty space
panel_timeline->cursor_frame = panel_timeline->getTimelineFrameFromScreenPoint(pos.x());
panel_timeline->cursor_track = getTrackFromScreenPoint(pos.y());
bool can_ripple_delete = true;
bool at_end_of_sequence = true;
rc_ripple_min = 0;
rc_ripple_max = LONG_MAX;
for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i);
if (c != nullptr) {
if (c->timeline_in > panel_timeline->cursor_frame || c->timeline_out > panel_timeline->cursor_frame) {
at_end_of_sequence = false;
}
if (c->track == panel_timeline->cursor_track) {
if (c->timeline_in <= panel_timeline->cursor_frame && c->timeline_out >= panel_timeline->cursor_frame) {
can_ripple_delete = false;
break;
} else if (c->timeline_out < panel_timeline->cursor_frame) {
rc_ripple_min = qMax(rc_ripple_min, c->timeline_out);
} else if (c->timeline_in > panel_timeline->cursor_frame) {
rc_ripple_max = qMin(rc_ripple_max, c->timeline_in);
}
}
}
}
if (can_ripple_delete && !at_end_of_sequence) {
if (panel_timeline->can_ripple_empty_space(panel_timeline->cursor_frame, panel_timeline->cursor_track)) {
QAction* ripple_delete_action = menu.addAction("R&ipple Delete");
connect(ripple_delete_action, SIGNAL(triggered(bool)), this, SLOT(right_click_ripple()));
connect(ripple_delete_action, SIGNAL(triggered(bool)), panel_timeline, SLOT(ripple_delete_empty_space()));
}
QAction* seq_settings = menu.addAction("Sequence Settings");
+2 -6
View File
@@ -63,13 +63,10 @@ private:
QVector<Clip*> pre_clips;
QVector<Clip*> post_clips;
Sequence* self_created_sequence;
// used for "right click ripple"
long rc_ripple_min;
long rc_ripple_max;
Media* rc_reveal_media;
Sequence* self_created_sequence;
QTimer tooltip_timer;
int tooltip_clip;
@@ -83,7 +80,6 @@ public slots:
private slots:
void reveal_media();
void right_click_ripple();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();