redid effects panel scrolling and #137
This commit is contained in:
+73
-1
@@ -453,12 +453,38 @@ EffectRow::EffectRow(Effect *parent, QGridLayout *uilayout, const QString &n, in
|
|||||||
label = new QLabel(name);
|
label = new QLabel(name);
|
||||||
ui->addWidget(label, row, 0);
|
ui->addWidget(label, row, 0);
|
||||||
|
|
||||||
|
QSize button_size(20, 20);
|
||||||
|
QSize icon_size(12, 12);
|
||||||
|
|
||||||
|
QHBoxLayout* key_controls = new QHBoxLayout();
|
||||||
|
key_controls->setSpacing(0);
|
||||||
|
key_controls->setMargin(0);
|
||||||
|
|
||||||
keyframe_enable = new QPushButton(QIcon(":/icons/clock.png"), "");
|
keyframe_enable = new QPushButton(QIcon(":/icons/clock.png"), "");
|
||||||
keyframe_enable->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
keyframe_enable->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
||||||
|
keyframe_enable->setMaximumSize(button_size);
|
||||||
|
keyframe_enable->setIconSize(icon_size);
|
||||||
keyframe_enable->setCheckable(true);
|
keyframe_enable->setCheckable(true);
|
||||||
keyframe_enable->setToolTip("Enable Keyframes");
|
keyframe_enable->setToolTip("Enable Keyframes");
|
||||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_enabled(bool)));
|
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SLOT(set_keyframe_enabled(bool)));
|
||||||
ui->addWidget(keyframe_enable, row, 6);
|
key_controls->addWidget(keyframe_enable);
|
||||||
|
|
||||||
|
QPushButton* left_key_nav = new QPushButton("<");
|
||||||
|
left_key_nav->setMaximumSize(button_size);
|
||||||
|
key_controls->addWidget(left_key_nav);
|
||||||
|
connect(left_key_nav, SIGNAL(clicked(bool)), this, SLOT(goto_previous_key()));
|
||||||
|
|
||||||
|
QPushButton* key_addremove = new QPushButton(".");
|
||||||
|
key_addremove->setMaximumSize(button_size);
|
||||||
|
key_controls->addWidget(key_addremove);
|
||||||
|
connect(key_addremove, SIGNAL(clicked(bool)), this, SLOT(toggle_key()));
|
||||||
|
|
||||||
|
QPushButton* right_key_nav = new QPushButton(">");
|
||||||
|
right_key_nav->setMaximumSize(button_size);
|
||||||
|
key_controls->addWidget(right_key_nav);
|
||||||
|
connect(right_key_nav, SIGNAL(clicked(bool)), this, SLOT(goto_next_key()));
|
||||||
|
|
||||||
|
ui->addLayout(key_controls, row, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectRow::isKeyframing() {
|
bool EffectRow::isKeyframing() {
|
||||||
@@ -489,6 +515,52 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EffectRow::goto_previous_key() {
|
||||||
|
long key = LONG_MIN;
|
||||||
|
Clip* c = parent_effect->parent_clip;
|
||||||
|
for (int i=0;i<keyframe_times.size();i++) {
|
||||||
|
long comp = keyframe_times.at(i) - c->clip_in + c->timeline_in;
|
||||||
|
if (comp < sequence->playhead) {
|
||||||
|
key = qMax(comp, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (key != LONG_MIN) panel_timeline->seek(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectRow::toggle_key() {
|
||||||
|
int index = -1;
|
||||||
|
Clip* c = parent_effect->parent_clip;
|
||||||
|
for (int i=0;i<keyframe_times.size();i++) {
|
||||||
|
long comp = c->timeline_in - c->clip_in + keyframe_times.at(i);
|
||||||
|
if (comp == sequence->playhead) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index < 0) {
|
||||||
|
// keyframe doesn't exist, set one
|
||||||
|
set_keyframe_now(true);
|
||||||
|
} else {
|
||||||
|
KeyframeDelete* kd = new KeyframeDelete();
|
||||||
|
delete_keyframe(kd, index);
|
||||||
|
undo_stack.push(kd);
|
||||||
|
panel_effect_controls->update_keyframes();
|
||||||
|
panel_viewer->viewer_widget->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectRow::goto_next_key() {
|
||||||
|
long key = LONG_MAX;
|
||||||
|
Clip* c = parent_effect->parent_clip;
|
||||||
|
for (int i=0;i<keyframe_times.size();i++) {
|
||||||
|
long comp = c->timeline_in - c->clip_in + keyframe_times.at(i);
|
||||||
|
if (comp > sequence->playhead) {
|
||||||
|
key = qMin(comp, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (key != LONG_MAX) panel_timeline->seek(key);
|
||||||
|
}
|
||||||
|
|
||||||
EffectField* EffectRow::add_field(int type, int colspan) {
|
EffectField* EffectRow::add_field(int type, int colspan) {
|
||||||
EffectField* field = new EffectField(this, type);
|
EffectField* field = new EffectField(this, type);
|
||||||
fields.append(field);
|
fields.append(field);
|
||||||
|
|||||||
@@ -161,6 +161,9 @@ public:
|
|||||||
QVector<int> keyframe_types;
|
QVector<int> keyframe_types;
|
||||||
private slots:
|
private slots:
|
||||||
void set_keyframe_enabled(bool);
|
void set_keyframe_enabled(bool);
|
||||||
|
void goto_previous_key();
|
||||||
|
void toggle_key();
|
||||||
|
void goto_next_key();
|
||||||
private:
|
private:
|
||||||
bool keyframing;
|
bool keyframing;
|
||||||
QGridLayout* ui;
|
QGridLayout* ui;
|
||||||
|
|||||||
@@ -36,13 +36,18 @@ EffectControls::EffectControls(QWidget *parent) :
|
|||||||
ui->effects_area->keyframe_area = ui->keyframeView;
|
ui->effects_area->keyframe_area = ui->keyframeView;
|
||||||
ui->effects_area->header = ui->headers;
|
ui->effects_area->header = ui->headers;
|
||||||
|
|
||||||
ui->keyframeHeaderScroller->setMaximumHeight(ui->headers->minimumHeight());
|
|
||||||
ui->keyframeView->header = ui->headers;
|
ui->keyframeView->header = ui->headers;
|
||||||
|
|
||||||
ui->label_2->setVisible(false);
|
ui->label_2->setVisible(false);
|
||||||
|
|
||||||
connect(ui->keyframeScroller->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
||||||
connect(ui->keyframeScroller->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->keyframeHeaderScroller->horizontalScrollBar(), SLOT(setValue(int)));
|
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_x_scroll(int)));
|
||||||
|
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_y_scroll(int)));
|
||||||
|
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||||
|
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->verticalScrollBar, SLOT(setValue(int)));
|
||||||
|
|
||||||
|
/*connect(ui->keyframeScroller->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||||
|
connect(ui->keyframeScroller->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectControls::~EffectControls() {
|
EffectControls::~EffectControls() {
|
||||||
@@ -201,7 +206,7 @@ void EffectControls::load_effects() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selected_clips.size() > 0) {
|
if (selected_clips.size() > 0) {
|
||||||
ui->keyframeView->setMinimumHeight(ui->effects_area->height());
|
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->height() - ui->keyframeView->height() - ui->headers->height()));
|
||||||
ui->keyframeView->setEnabled(true);
|
ui->keyframeView->setEnabled(true);
|
||||||
ui->headers->setVisible(true);
|
ui->headers->setVisible(true);
|
||||||
ui->keyframeView->update();
|
ui->keyframeView->update();
|
||||||
@@ -264,6 +269,10 @@ void EffectControls::on_add_audio_transition_button_clicked()
|
|||||||
show_effect_menu(false, true);
|
show_effect_menu(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EffectControls::resizeEvent(QResizeEvent *event) {
|
||||||
|
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->height() - ui->keyframeView->height() - ui->headers->height()));
|
||||||
|
}
|
||||||
|
|
||||||
bool EffectControls::is_focused() {
|
bool EffectControls::is_focused() {
|
||||||
if (this->hasFocus()) return true;
|
if (this->hasFocus()) return true;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
@@ -285,5 +294,4 @@ EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
|||||||
|
|
||||||
void EffectsArea::resizeEvent(QResizeEvent*) {
|
void EffectsArea::resizeEvent(QResizeEvent*) {
|
||||||
parent_widget->setMinimumWidth(sizeHint().width());
|
parent_widget->setMinimumWidth(sizeHint().width());
|
||||||
keyframe_area->setMinimumHeight(height() - header->height());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
QVector<int> selected_clips;
|
QVector<int> selected_clips;
|
||||||
|
|
||||||
double zoom;
|
double zoom;
|
||||||
|
|
||||||
|
Ui::EffectControls *ui;
|
||||||
public slots:
|
public slots:
|
||||||
void update_keyframes();
|
void update_keyframes();
|
||||||
private slots:
|
private slots:
|
||||||
@@ -55,9 +57,9 @@ private slots:
|
|||||||
void on_add_video_transition_button_clicked();
|
void on_add_video_transition_button_clicked();
|
||||||
|
|
||||||
void on_add_audio_transition_button_clicked();
|
void on_add_audio_transition_button_clicked();
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *event);
|
||||||
private:
|
private:
|
||||||
Ui::EffectControls *ui;
|
|
||||||
void show_effect_menu(bool video, bool transitions);
|
void show_effect_menu(bool video, bool transitions);
|
||||||
void load_effects();
|
void load_effects();
|
||||||
void load_keyframes();
|
void load_keyframes();
|
||||||
|
|||||||
+55
-103
@@ -435,7 +435,7 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -452,117 +452,69 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="keyframeHeaderScroller">
|
<widget class="TimelineHeader" name="headers" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_3">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>390</width>
|
|
||||||
<height>68</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="TimelineHeader" name="headers" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::ClickFocus</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="keyframeScroller">
|
<widget class="QWidget" name="keyframeCenterWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<property name="spacing">
|
||||||
<horstretch>1</horstretch>
|
<number>0</number>
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>378</width>
|
|
||||||
<height>407</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<property name="leftMargin">
|
||||||
<property name="spacing">
|
<number>0</number>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
<property name="topMargin">
|
||||||
<property name="leftMargin">
|
<number>0</number>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
<property name="topMargin">
|
<number>0</number>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
<property name="bottomMargin">
|
||||||
<property name="rightMargin">
|
<number>0</number>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
<item>
|
||||||
<property name="bottomMargin">
|
<widget class="KeyframeView" name="keyframeView" native="true"/>
|
||||||
<number>0</number>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<item>
|
<widget class="QScrollBar" name="verticalScrollBar">
|
||||||
<widget class="KeyframeView" name="keyframeView" native="true"/>
|
<property name="maximum">
|
||||||
</item>
|
<number>0</number>
|
||||||
</layout>
|
</property>
|
||||||
</widget>
|
<property name="singleStep">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1826</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
+1
-2
@@ -91,9 +91,7 @@ Timeline::Timeline(QWidget *parent) :
|
|||||||
|
|
||||||
ui->toolArrowButton->click();
|
ui->toolArrowButton->click();
|
||||||
|
|
||||||
ui->headerScrollArea->setMaximumHeight(ui->headers->minimumHeight());
|
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(setScroll(int)));
|
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(setScroll(int)));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
|
||||||
connect(ui->videoScrollbar, SIGNAL(valueChanged(int)), ui->video_area, SLOT(setScroll(int)));
|
connect(ui->videoScrollbar, SIGNAL(valueChanged(int)), ui->video_area, SLOT(setScroll(int)));
|
||||||
connect(ui->audioScrollbar, SIGNAL(valueChanged(int)), ui->audio_area, SLOT(setScroll(int)));
|
connect(ui->audioScrollbar, SIGNAL(valueChanged(int)), ui->audio_area, SLOT(setScroll(int)));
|
||||||
|
|
||||||
@@ -1294,5 +1292,6 @@ void Timeline::addMenuItem(QAction* action) {
|
|||||||
|
|
||||||
void Timeline::setScroll(int s) {
|
void Timeline::setScroll(int s) {
|
||||||
scroll = s;
|
scroll = s;
|
||||||
|
ui->headers->set_scroll(s);
|
||||||
repaint_timeline(false);
|
repaint_timeline(false);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-67
@@ -285,7 +285,7 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -302,77 +302,13 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="headerScrollArea">
|
<widget class="TimelineHeader" name="headers" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_5">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>821</width>
|
|
||||||
<height>16</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="TimelineHeader" name="headers" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::ClickFocus</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -117,6 +117,10 @@ void Viewer::update_end_timecode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void Viewer::update_media(int type) {
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
void Viewer::update_sequence() {
|
void Viewer::update_sequence() {
|
||||||
bool null_sequence = (sequence == NULL);
|
bool null_sequence = (sequence == NULL);
|
||||||
|
|
||||||
|
|||||||
+28
-7
@@ -11,9 +11,11 @@
|
|||||||
#include "panels/viewer.h"
|
#include "panels/viewer.h"
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
#include "project/sequence.h"
|
#include "project/sequence.h"
|
||||||
|
#include "ui_effectcontrols.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QtMath>
|
||||||
|
|
||||||
#define KEYFRAME_SIZE 6
|
#define KEYFRAME_SIZE 6
|
||||||
#define KEYFRAME_POINT_COUNT 4
|
#define KEYFRAME_POINT_COUNT 4
|
||||||
@@ -22,7 +24,17 @@ long KeyframeView::adjust_row_keyframe(EffectRow* row, long time) {
|
|||||||
return time-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
return time-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyframeView::KeyframeView(QWidget *parent) : QWidget(parent), mousedown(false), dragging(false), keys_selected(false), select_rect(false), visible_in(0), visible_out(0) {
|
KeyframeView::KeyframeView(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
mousedown(false),
|
||||||
|
dragging(false),
|
||||||
|
keys_selected(false),
|
||||||
|
select_rect(false),
|
||||||
|
visible_in(0),
|
||||||
|
visible_out(0),
|
||||||
|
x_scroll(0),
|
||||||
|
y_scroll(0)
|
||||||
|
{
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
}
|
}
|
||||||
@@ -50,12 +62,12 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
QLabel* label = row->label;
|
QLabel* label = row->label;
|
||||||
QWidget* contents = e->container->contents;
|
QWidget* contents = e->container->contents;
|
||||||
|
|
||||||
int keyframe_y = label->y() + (label->height()>>1) + mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y() - e->container->title_bar->height();
|
int keyframe_y = label->y() + (label->height()>>1) + mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y() - e->container->title_bar->height()/* - y_scroll*/;
|
||||||
for (int k=0;k<row->keyframe_times.size();k++) {
|
for (int k=0;k<row->keyframe_times.size();k++) {
|
||||||
bool keyframe_selected = keyframeIsSelected(row, k);
|
bool keyframe_selected = keyframeIsSelected(row, k);
|
||||||
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
||||||
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
||||||
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame), keyframe_y, keyframe_selected);
|
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame) - x_scroll, keyframe_y, keyframe_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.append(row);
|
rows.append(row);
|
||||||
@@ -68,12 +80,11 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
visible_in = effects_in;
|
visible_in = effects_in;
|
||||||
visible_out = effects_out;
|
visible_out = effects_out;
|
||||||
|
|
||||||
int width = getScreenPointFromFrame(panel_effect_controls->zoom, visible_out - visible_in);
|
int max_width = getScreenPointFromFrame(panel_effect_controls->zoom, visible_out - visible_in);
|
||||||
setMinimumWidth(width);
|
panel_effect_controls->ui->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
||||||
header->setMinimumWidth(width);
|
|
||||||
header->set_visible_in(effects_in);
|
header->set_visible_in(effects_in);
|
||||||
|
|
||||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in);
|
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in) - x_scroll;
|
||||||
p.setPen(Qt::red);
|
p.setPen(Qt::red);
|
||||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||||
}
|
}
|
||||||
@@ -115,6 +126,16 @@ void KeyframeView::delete_selected_keyframes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyframeView::set_x_scroll(int s) {
|
||||||
|
x_scroll = s;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyframeView::set_y_scroll(int s) {
|
||||||
|
y_scroll = s;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void KeyframeView::draw_keyframe(QPainter &p, int x, int y, bool darker) {
|
void KeyframeView::draw_keyframe(QPainter &p, int x, int y, bool darker) {
|
||||||
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
||||||
int color = (darker) ? 100 : 160;
|
int color = (darker) ? 100 : 160;
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public:
|
|||||||
|
|
||||||
long visible_in;
|
long visible_in;
|
||||||
long visible_out;
|
long visible_out;
|
||||||
|
public slots:
|
||||||
|
void set_x_scroll(int);
|
||||||
|
void set_y_scroll(int);
|
||||||
private:
|
private:
|
||||||
long adjust_row_keyframe(EffectRow* row, long time);
|
long adjust_row_keyframe(EffectRow* row, long time);
|
||||||
QVector<EffectRow*> selected_rows;
|
QVector<EffectRow*> selected_rows;
|
||||||
@@ -45,6 +48,9 @@ private:
|
|||||||
int rect_select_y;
|
int rect_select_y;
|
||||||
int rect_select_w;
|
int rect_select_w;
|
||||||
int rect_select_h;
|
int rect_select_h;
|
||||||
|
|
||||||
|
int x_scroll;
|
||||||
|
int y_scroll;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEYFRAMEVIEW_H
|
#endif // KEYFRAMEVIEW_H
|
||||||
|
|||||||
+15
-4
@@ -32,7 +32,8 @@ TimelineHeader::TimelineHeader(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setMinimumHeight(fm.height()*2);
|
setFixedHeight(fm.height()*2);
|
||||||
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::set_scroll(int s) {
|
void TimelineHeader::set_scroll(int s) {
|
||||||
@@ -51,7 +52,9 @@ int TimelineHeader::getHeaderScreenPointFromFrame(long frame) {
|
|||||||
void TimelineHeader::set_playhead(int mouse_x) {
|
void TimelineHeader::set_playhead(int mouse_x) {
|
||||||
long frame = getHeaderFrameFromScreenPoint(mouse_x);
|
long frame = getHeaderFrameFromScreenPoint(mouse_x);
|
||||||
if (snapping) panel_timeline->snap_to_timeline(&frame, false, true, true);
|
if (snapping) panel_timeline->snap_to_timeline(&frame, false, true, true);
|
||||||
panel_timeline->seek(frame);
|
if (frame != sequence->playhead) {
|
||||||
|
panel_timeline->seek(frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::set_visible_in(long i) {
|
void TimelineHeader::set_visible_in(long i) {
|
||||||
@@ -83,6 +86,7 @@ void TimelineHeader::set_out_point(long new_out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
||||||
|
qDebug() << "press???!?!?!??!";
|
||||||
if (resizing_workarea) {
|
if (resizing_workarea) {
|
||||||
sequence_end = sequence->getEndFrame();
|
sequence_end = sequence->getEndFrame();
|
||||||
} else {
|
} else {
|
||||||
@@ -127,11 +131,15 @@ void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
|||||||
set_playhead(event->pos().x());
|
set_playhead(event->pos().x());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qDebug() << "3";
|
||||||
dragging = true;
|
dragging = true;
|
||||||
|
qDebug() << "5" << dragging;
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||||
if (dragging) {
|
qDebug() << "move";
|
||||||
|
if (dragging) {
|
||||||
if (resizing_workarea) {
|
if (resizing_workarea) {
|
||||||
long frame = getHeaderFrameFromScreenPoint(event->pos().x());
|
long frame = getHeaderFrameFromScreenPoint(event->pos().x());
|
||||||
panel_timeline->snap_to_timeline(&frame, true, true, false);
|
panel_timeline->snap_to_timeline(&frame, true, true, false);
|
||||||
@@ -193,9 +201,11 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
void TimelineHeader::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
|
qDebug() << "release???!?!?!??!";
|
||||||
if (resizing_workarea) {
|
if (resizing_workarea) {
|
||||||
undo_stack.push(new SetTimelineInOutCommand(sequence, true, temp_workarea_in, temp_workarea_out));
|
undo_stack.push(new SetTimelineInOutCommand(sequence, true, temp_workarea_in, temp_workarea_out));
|
||||||
} else if (dragging_markers && selected_markers.size() > 0) {
|
} else if (dragging_markers && selected_markers.size() > 0) {
|
||||||
@@ -220,6 +230,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
|||||||
dragging_markers = false;
|
dragging_markers = false;
|
||||||
panel_timeline->snapped = false;
|
panel_timeline->snapped = false;
|
||||||
panel_timeline->repaint_timeline(false);
|
panel_timeline->repaint_timeline(false);
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineHeader::focusOutEvent(QFocusEvent*) {
|
void TimelineHeader::focusOutEvent(QFocusEvent*) {
|
||||||
|
|||||||
+5
-5
@@ -24,11 +24,11 @@ public slots:
|
|||||||
void set_visible_in(long i);
|
void set_visible_in(long i);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent*);
|
void paintEvent(QPaintEvent*);
|
||||||
void mousePressEvent(QMouseEvent*);
|
void mousePressEvent(QMouseEvent*);
|
||||||
void mouseMoveEvent(QMouseEvent*);
|
void mouseMoveEvent(QMouseEvent*);
|
||||||
void mouseReleaseEvent(QMouseEvent*);
|
void mouseReleaseEvent(QMouseEvent*);
|
||||||
void focusOutEvent(QFocusEvent *event);
|
void focusOutEvent(QFocusEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dragging;
|
bool dragging;
|
||||||
|
|||||||
+13
-7
@@ -367,14 +367,20 @@ void TimelineWidget::dragMoveEvent(QDragMoveEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TimelineWidget::wheelEvent(QWheelEvent *event) {
|
void TimelineWidget::wheelEvent(QWheelEvent *event) {
|
||||||
if (config.scroll_zooms) {
|
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||||
if (event->angleDelta().y() != 0) panel_timeline->set_zoom(event->angleDelta().y() > 0);
|
int scroll_amount = alt ? (event->angleDelta().x()) : (event->angleDelta().y());
|
||||||
} else {
|
if (scroll_amount != 0) {
|
||||||
QScrollBar* bar = (event->modifiers() & Qt::ShiftModifier) ? scrollBar : panel_timeline->ui->horizontalScrollBar;
|
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||||
|
bool in = (scroll_amount > 0);
|
||||||
|
if (config.scroll_zooms != shift) {
|
||||||
|
panel_timeline->set_zoom(in);
|
||||||
|
} else {
|
||||||
|
QScrollBar* bar = alt ? scrollBar : panel_timeline->ui->horizontalScrollBar;
|
||||||
|
|
||||||
int step = bar->singleStep();
|
int step = bar->singleStep();
|
||||||
if (event->angleDelta().y() > 0) step = -step;
|
if (in) step = -step;
|
||||||
bar->setValue(bar->value() + step);
|
bar->setValue(bar->value() + step);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user