merge of previous commits
This commit is contained in:
+3
-13
@@ -417,16 +417,6 @@ bool Timeline::focused() {
|
||||
return (sequence != NULL && (ui->headers->hasFocus() || ui->video_area->hasFocus() || ui->audio_area->hasFocus()));
|
||||
}
|
||||
|
||||
bool Timeline::center_scroll_to_playhead() {
|
||||
// returns true is the scroll was changed, false if not
|
||||
int target_scroll = qMin(ui->horizontalScrollBar->maximum(), qMax(0, getScreenPointFromFrame(zoom, sequence->playhead)-(ui->editAreas->width()>>1)));
|
||||
if (target_scroll == ui->horizontalScrollBar->value()) {
|
||||
return false;
|
||||
}
|
||||
ui->horizontalScrollBar->setValue(target_scroll);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Timeline::repaint_timeline() {
|
||||
bool draw = true;
|
||||
|
||||
@@ -442,7 +432,7 @@ void Timeline::repaint_timeline() {
|
||||
draw = false;
|
||||
}
|
||||
} else if (config.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) {
|
||||
if (center_scroll_to_playhead()) {
|
||||
if (center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead)) {
|
||||
draw = false;
|
||||
}
|
||||
}
|
||||
@@ -458,7 +448,7 @@ void Timeline::repaint_timeline() {
|
||||
if (sequence != NULL) {
|
||||
long sequenceEndFrame = sequence->getEndFrame();
|
||||
|
||||
ui->horizontalScrollBar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequenceEndFrame) - (ui->editAreas->width()/2)));
|
||||
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, sequenceEndFrame, (ui->editAreas->width()/2));
|
||||
|
||||
if (last_frame != sequence->playhead) {
|
||||
ui->audio_monitor->update();
|
||||
@@ -579,7 +569,7 @@ void Timeline::set_zoom_value(double v) {
|
||||
repaint_timeline();
|
||||
|
||||
// TODO find a way to gradually move towards target_scroll instead of just centering it?
|
||||
center_scroll_to_playhead();
|
||||
center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead);
|
||||
}
|
||||
|
||||
void Timeline::set_zoom(bool in) {
|
||||
|
||||
+1
-2
@@ -227,8 +227,7 @@ private:
|
||||
void set_zoom_value(double v);
|
||||
QVector<QPushButton*> tool_buttons;
|
||||
void decheck_tool_buttons(QObject* sender);
|
||||
void set_tool(int tool);
|
||||
bool center_scroll_to_playhead();
|
||||
void set_tool(int tool);
|
||||
long last_frame;
|
||||
int scroll;
|
||||
|
||||
|
||||
+28
-4
@@ -39,7 +39,8 @@ Viewer::Viewer(QWidget *parent) :
|
||||
ui(new Ui::Viewer),
|
||||
created_sequence(false),
|
||||
cue_recording_internal(false),
|
||||
panel_name("Viewer: ")
|
||||
panel_name("Viewer: "),
|
||||
minimum_zoom(1.0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->headers->viewer = this;
|
||||
@@ -61,6 +62,8 @@ Viewer::Viewer(QWidget *parent) :
|
||||
|
||||
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
||||
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->openGLWidget, SLOT(set_waveform_scroll(int)));
|
||||
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
@@ -382,7 +385,14 @@ void Viewer::update_end_timecode() {
|
||||
void Viewer::update_header_zoom() {
|
||||
if (seq != NULL) {
|
||||
long sequenceEndFrame = seq->getEndFrame();
|
||||
ui->headers->update_zoom((sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1);
|
||||
if (cached_end_frame != sequenceEndFrame) {
|
||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1;
|
||||
ui->headers->update_zoom(qMax(ui->headers->get_zoom(), minimum_zoom));
|
||||
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, sequenceEndFrame, ui->headers->width());
|
||||
ui->openGLWidget->waveform_zoom = ui->headers->get_zoom();
|
||||
} else {
|
||||
ui->headers->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,8 +405,8 @@ void Viewer::update_parents() {
|
||||
}
|
||||
|
||||
void Viewer::update_viewer() {
|
||||
update_header_zoom();
|
||||
viewer_widget->update();
|
||||
update_header_zoom();
|
||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
}
|
||||
@@ -413,7 +423,21 @@ void Viewer::set_in_point() {
|
||||
}
|
||||
|
||||
void Viewer::set_out_point() {
|
||||
ui->headers->set_out_point(seq->playhead);
|
||||
ui->headers->set_out_point(seq->playhead);
|
||||
}
|
||||
|
||||
void Viewer::set_zoom(bool in) {
|
||||
if (in) {
|
||||
ui->headers->update_zoom(ui->headers->get_zoom()*2);
|
||||
} else {
|
||||
ui->headers->update_zoom(qMax(minimum_zoom, ui->headers->get_zoom()*0.5));
|
||||
}
|
||||
if (ui->openGLWidget->waveform) {
|
||||
ui->openGLWidget->waveform_zoom = ui->headers->get_zoom();
|
||||
ui->openGLWidget->update();
|
||||
}
|
||||
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, seq->getEndFrame(), ui->headers->width());
|
||||
center_scroll_to_playhead(ui->horizontalScrollBar, ui->headers->get_zoom(), seq->playhead);
|
||||
}
|
||||
|
||||
void Viewer::set_media(Media* m) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
void clear_inout_point();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
|
||||
// playback functions
|
||||
void go_to_start();
|
||||
@@ -88,7 +89,9 @@ private:
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
QString panel_name;
|
||||
double minimum_zoom;
|
||||
|
||||
bool cue_recording_internal;
|
||||
QTimer recording_flasher;
|
||||
|
||||
@@ -64,6 +64,22 @@
|
||||
<item>
|
||||
<widget class="TimelineHeader" name="headers" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="horizontalScrollBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="playbackControls" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
||||
Reference in New Issue
Block a user