minor improvements
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "speeddialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
|
||||
SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) {
|
||||
QGridLayout* layout = new QGridLayout();
|
||||
layout->setSpacing(6);
|
||||
layout->setMargin(9);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
layout->addWidget(new QLabel("Speed:"), 0, 0);
|
||||
percent = new LabelSlider();
|
||||
percent->set_display_type(LABELSLIDER_PERCENT);
|
||||
layout->addWidget(percent, 0, 1);
|
||||
|
||||
layout->addWidget(new QLabel("Frame Rate:"), 1, 0);
|
||||
frame_rate = new LabelSlider();
|
||||
layout->addWidget(frame_rate, 1, 1);
|
||||
|
||||
layout->addWidget(new QLabel("Duration:"), 2, 0);
|
||||
duration = new LabelSlider();
|
||||
duration->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
layout->addWidget(duration, 2, 1);
|
||||
|
||||
QHBoxLayout* reverseLayout = new QHBoxLayout();
|
||||
reverse = new QCheckBox("Reverse");
|
||||
reverseLayout->addWidget(reverse);
|
||||
layout->addLayout(reverseLayout, 3, 0, 2, 1);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this, QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
layout->addWidget(buttonBox, 4, 0, 2, 1);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef SPEEDDIALOG_H
|
||||
#define SPEEDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
struct Clip;
|
||||
class LabelSlider;
|
||||
class QCheckBox;
|
||||
|
||||
class SpeedDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
SpeedDialog(QWidget* parent = 0);
|
||||
QVector<Clip*> clips;
|
||||
private:
|
||||
LabelSlider* percent;
|
||||
LabelSlider* duration;
|
||||
LabelSlider* frame_rate;
|
||||
|
||||
QCheckBox* reverse;
|
||||
};
|
||||
|
||||
#endif // SPEEDDIALOG_H
|
||||
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpeedDialog</class>
|
||||
<widget class="QDialog" name="SpeedDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Frame Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SpeedDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SpeedDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+1
-1
@@ -503,7 +503,7 @@ EffectRow::~EffectRow() {
|
||||
|
||||
void EffectRow::set_keyframe_now(bool undoable) {
|
||||
int index = -1;
|
||||
long time = panel_timeline->playhead-parent_effect->parent_clip->timeline_in+parent_effect->parent_clip->clip_in;
|
||||
long time = sequence->playhead-parent_effect->parent_clip->timeline_in+parent_effect->parent_clip->clip_in;
|
||||
for (int i=0;i<keyframe_times.size();i++) {
|
||||
if (keyframe_times.at(i) == time) {
|
||||
index = i;
|
||||
|
||||
@@ -216,7 +216,7 @@ void TextEffect::redraw(double timecode) {
|
||||
case Qt::AlignJustify:
|
||||
// add spaces until the string is too big
|
||||
text_x = 0;
|
||||
while (fm.width(lines.at(i) < width)) {
|
||||
while (fm.width(lines.at(i)) < width) {
|
||||
bool space = false;
|
||||
QString spaced(lines.at(i));
|
||||
for (int i=0;i<spaced.length();i++) {
|
||||
|
||||
+7
-2
@@ -21,7 +21,8 @@ Config::Config()
|
||||
timecode_view(TIMECODE_DROP),
|
||||
show_title_safe_area(false),
|
||||
use_custom_title_safe_ratio(false),
|
||||
custom_title_safe_ratio(1)
|
||||
custom_title_safe_ratio(1),
|
||||
enable_drag_files_to_timeline(false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -76,7 +77,10 @@ void Config::load(QString path) {
|
||||
} else if (stream.name() == "CustomTitleSafeRatio") {
|
||||
stream.readNext();
|
||||
custom_title_safe_ratio = stream.text().toDouble();
|
||||
}
|
||||
} else if (stream.name() == "EnableDragFilesToTimeline") {
|
||||
stream.readNext();
|
||||
enable_drag_files_to_timeline = (stream.text() == "1");;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stream.hasError()) {
|
||||
@@ -136,6 +140,7 @@ void Config::save(QString path) {
|
||||
stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area));
|
||||
stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio));
|
||||
stream.writeTextElement("CustomTitleSafeRatio", QString::number(custom_title_safe_ratio));
|
||||
stream.writeTextElement("EnableDragFilesToTimeline", QString::number(enable_drag_files_to_timeline));
|
||||
|
||||
stream.writeEndElement();
|
||||
stream.writeEndDocument(); // doc
|
||||
|
||||
@@ -25,6 +25,7 @@ struct Config {
|
||||
bool show_title_safe_area;
|
||||
bool use_custom_title_safe_ratio;
|
||||
double custom_title_safe_ratio;
|
||||
bool enable_drag_files_to_timeline;
|
||||
|
||||
void load(QString path);
|
||||
void save(QString path);
|
||||
|
||||
+4
-4
@@ -345,10 +345,10 @@ void ExportThread::run() {
|
||||
|
||||
long file_audio_samples = 0;
|
||||
|
||||
while (panel_timeline->playhead < end_frame && continueEncode) {
|
||||
while (sequence->playhead < end_frame && continueEncode) {
|
||||
panel_viewer->viewer_widget->paintGL();
|
||||
|
||||
double timecode_secs = (double) (panel_timeline->playhead-start_frame) / sequence->frame_rate;
|
||||
double timecode_secs = (double) (sequence->playhead-start_frame) / sequence->frame_rate;
|
||||
if (video_enabled) {
|
||||
// get image from opengl
|
||||
glReadPixels(0, 0, video_frame->linesize[0]/4, sequence->height, GL_RGBA, GL_UNSIGNED_BYTE, video_frame->data[0]);
|
||||
@@ -387,8 +387,8 @@ void ExportThread::run() {
|
||||
file_audio_samples += swr_frame->nb_samples;
|
||||
}
|
||||
}
|
||||
emit progress_changed(((double) (panel_timeline->playhead-start_frame) / (double) (end_frame-start_frame)) * 100);
|
||||
panel_timeline->playhead++;
|
||||
emit progress_changed(((double) (sequence->playhead-start_frame) / (double) (end_frame-start_frame)) * 100);
|
||||
sequence->playhead++;
|
||||
}
|
||||
|
||||
panel_viewer->viewer_widget->default_fbo = NULL;
|
||||
|
||||
@@ -55,7 +55,7 @@ void PreviewGenerator::parse_media() {
|
||||
ms->video_frame_rate = 0;
|
||||
} else {
|
||||
ms->infinite_length = false;
|
||||
ms->video_frame_rate = av_q2d(fmt_ctx->streams[i]->avg_frame_rate);
|
||||
ms->video_frame_rate = av_q2d(fmt_ctx->streams[i]->avg_frame_rate)*0.5;
|
||||
}
|
||||
ms->video_width = fmt_ctx->streams[i]->codecpar->width;
|
||||
ms->video_height = fmt_ctx->streams[i]->codecpar->height;
|
||||
|
||||
+35
-13
@@ -21,6 +21,7 @@
|
||||
#include "dialogs/exportdialog.h"
|
||||
#include "dialogs/preferencesdialog.h"
|
||||
#include "dialogs/demonotice.h"
|
||||
#include "dialogs/speeddialog.h"
|
||||
|
||||
#include "playback/audio.h"
|
||||
#include "playback/playback.h"
|
||||
@@ -38,6 +39,8 @@
|
||||
#include <QInputDialog>
|
||||
#include <QRegExp>
|
||||
|
||||
QMainWindow* mainWindow;
|
||||
|
||||
#define OLIVE_FILE_FILTER "Olive Project (*.ove)"
|
||||
|
||||
QTimer autorecovery_timer;
|
||||
@@ -63,6 +66,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
mainWindow = this;
|
||||
|
||||
// set up style?
|
||||
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
@@ -145,6 +150,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
config.load(config_dir);
|
||||
}
|
||||
}
|
||||
|
||||
connect(ui->action_Undo, SIGNAL(triggered(bool)), this, SLOT(undo()));
|
||||
connect(ui->action_Redo, SIGNAL(triggered(bool)), this, SLOT(redo()));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
@@ -271,18 +279,27 @@ void MainWindow::editMenu_About_To_Be_Shown() {
|
||||
ui->action_Redo->setEnabled(undo_stack.canRedo());
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Undo_triggered()
|
||||
{
|
||||
undo_stack.undo();
|
||||
editMenu_About_To_Be_Shown();
|
||||
void MainWindow::undo() {
|
||||
undo_stack.undo();
|
||||
panel_timeline->redraw_all_clips(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Redo_triggered()
|
||||
{
|
||||
undo_stack.redo();
|
||||
editMenu_About_To_Be_Shown();
|
||||
panel_timeline->redraw_all_clips(true);
|
||||
void MainWindow::redo() {
|
||||
undo_stack.redo();
|
||||
panel_timeline->redraw_all_clips(true);
|
||||
}
|
||||
|
||||
void MainWindow::openSpeedDialog() {
|
||||
if (sequence != NULL) {
|
||||
SpeedDialog s(this);
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL & panel_timeline->is_clip_selected(c, true)) {
|
||||
s.clips.append(c);
|
||||
}
|
||||
}
|
||||
if (s.clips.size() > 0) s.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSplit_at_Playhead_triggered()
|
||||
@@ -410,7 +427,7 @@ void MainWindow::on_actionProject_triggered()
|
||||
panel_project->new_project();
|
||||
updateTitle("");
|
||||
panel_timeline->redraw_all_clips(false);
|
||||
panel_timeline->playhead = 0;
|
||||
sequence->playhead = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +573,7 @@ void MainWindow::on_actionFrames_triggered()
|
||||
{
|
||||
config.timecode_view = TIMECODE_FRAMES;
|
||||
if (sequence != NULL) {
|
||||
panel_viewer->update_playhead_timecode(panel_timeline->playhead);
|
||||
panel_viewer->update_playhead_timecode(sequence->playhead);
|
||||
panel_viewer->update_end_timecode();
|
||||
}
|
||||
}
|
||||
@@ -565,7 +582,7 @@ void MainWindow::on_actionDrop_Frame_triggered()
|
||||
{
|
||||
config.timecode_view = TIMECODE_DROP;
|
||||
if (sequence != NULL) {
|
||||
panel_viewer->update_playhead_timecode(panel_timeline->playhead);
|
||||
panel_viewer->update_playhead_timecode(sequence->playhead);
|
||||
panel_viewer->update_end_timecode();
|
||||
}
|
||||
}
|
||||
@@ -574,7 +591,7 @@ void MainWindow::on_actionNon_Drop_Frame_triggered()
|
||||
{
|
||||
config.timecode_view = TIMECODE_NONDROP;
|
||||
if (sequence != NULL) {
|
||||
panel_viewer->update_playhead_timecode(panel_timeline->playhead);
|
||||
panel_viewer->update_playhead_timecode(sequence->playhead);
|
||||
panel_viewer->update_end_timecode();
|
||||
}
|
||||
}
|
||||
@@ -587,6 +604,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
|
||||
ui->actionToggle_Snapping->setChecked(panel_timeline->snapping);
|
||||
ui->actionScroll_Wheel_Zooms->setChecked(config.scroll_zooms);
|
||||
ui->actionRectified_Waveforms->setChecked(config.rectified_waveforms);
|
||||
ui->actionEnable_Drag_Files_to_Timeline->setChecked(config.enable_drag_files_to_timeline);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEdit_Tool_Selects_Links_triggered() {
|
||||
@@ -767,3 +785,7 @@ void MainWindow::on_actionCustom_triggered() {
|
||||
panel_viewer->viewer_widget->update();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEnable_Drag_Files_to_Timeline_triggered() {
|
||||
config.enable_drag_files_to_timeline = !config.enable_drag_files_to_timeline;
|
||||
}
|
||||
|
||||
+9
-4
@@ -8,6 +8,8 @@ class EffectControls;
|
||||
class Viewer;
|
||||
class Timeline;
|
||||
|
||||
extern QMainWindow* mainWindow;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
@@ -20,6 +22,11 @@ public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void undo();
|
||||
void redo();
|
||||
void openSpeedDialog();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
@@ -53,10 +60,6 @@ private slots:
|
||||
|
||||
void on_actionRipple_Delete_triggered();
|
||||
|
||||
void on_action_Undo_triggered();
|
||||
|
||||
void on_action_Redo_triggered();
|
||||
|
||||
void on_actionSplit_at_Playhead_triggered();
|
||||
|
||||
void on_actionCu_t_triggered();
|
||||
@@ -179,6 +182,8 @@ private slots:
|
||||
|
||||
void on_actionCustom_triggered();
|
||||
|
||||
void on_actionEnable_Drag_Files_to_Timeline_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
void setup_layout();
|
||||
|
||||
+13
-2
@@ -14,7 +14,7 @@
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/full-icon.png</normaloff>:/icons/full-icon.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
@@ -175,6 +175,7 @@
|
||||
<addaction name="actionSeek_to_the_End_of_Pastes"/>
|
||||
<addaction name="actionScroll_Wheel_Zooms"/>
|
||||
<addaction name="actionRectified_Waveforms"/>
|
||||
<addaction name="actionEnable_Drag_Files_to_Timeline"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="actionCrash"/>
|
||||
@@ -761,8 +762,18 @@
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Drag_Files_to_Timeline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Drag Files to Timeline</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="icons/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -80,7 +80,9 @@ SOURCES += \
|
||||
effects/video/boxblureffect.cpp \
|
||||
dialogs/demonotice.cpp \
|
||||
effects/audio/toneeffect.cpp \
|
||||
project/marker.cpp
|
||||
project/marker.cpp \
|
||||
dialogs/speeddialog.cpp \
|
||||
dialogs/speeddialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -137,7 +139,10 @@ HEADERS += \
|
||||
effects/video/boxblureffect.h \
|
||||
dialogs/demonotice.h \
|
||||
effects/audio/toneeffect.h \
|
||||
project/marker.h
|
||||
project/marker.h \
|
||||
project/selection.h \
|
||||
dialogs/speeddialog.h \
|
||||
dialogs/speeddialog.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
|
||||
@@ -36,6 +36,7 @@ EffectControls::EffectControls(QWidget *parent) :
|
||||
ui->effects_area->keyframe_area = ui->keyframeView;
|
||||
ui->effects_area->header = ui->headers;
|
||||
|
||||
ui->keyframeHeaderScroller->setMaximumHeight(ui->headers->minimumHeight());
|
||||
ui->keyframeView->header = ui->headers;
|
||||
|
||||
ui->label_2->setVisible(false);
|
||||
|
||||
@@ -459,12 +459,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
@@ -480,7 +474,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>390</width>
|
||||
<height>16</height>
|
||||
<height>68</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@@ -507,12 +501,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
@@ -551,7 +539,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>378</width>
|
||||
<height>462</height>
|
||||
<height>407</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
||||
+55
-56
@@ -37,8 +37,7 @@ void draw_selection_rectangle(QPainter& painter, const QRect& rect) {
|
||||
}
|
||||
|
||||
Timeline::Timeline(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
playhead(0),
|
||||
QDockWidget(parent),
|
||||
playing(false),
|
||||
cursor_frame(0),
|
||||
cursor_track(0),
|
||||
@@ -101,22 +100,22 @@ void Timeline::go_to_start() {
|
||||
}
|
||||
|
||||
void Timeline::previous_frame() {
|
||||
if (playhead > 0) seek(playhead-1);
|
||||
if (sequence->playhead > 0) seek(sequence->playhead-1);
|
||||
}
|
||||
|
||||
void Timeline::next_frame() {
|
||||
seek(playhead+1);
|
||||
seek(sequence->playhead+1);
|
||||
}
|
||||
|
||||
void Timeline::previous_cut() {
|
||||
if (playhead > 0) {
|
||||
if (sequence->playhead > 0) {
|
||||
long p_cut = 0;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c->timeline_out > p_cut && c->timeline_out < playhead) {
|
||||
if (c->timeline_out > p_cut && c->timeline_out < sequence->playhead) {
|
||||
p_cut = c->timeline_out;
|
||||
} else if (c->timeline_in > p_cut && c->timeline_in < playhead) {
|
||||
} else if (c->timeline_in > p_cut && c->timeline_in < sequence->playhead) {
|
||||
p_cut = c->timeline_in;
|
||||
}
|
||||
}
|
||||
@@ -131,10 +130,10 @@ void Timeline::next_cut() {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c->timeline_in < n_cut && c->timeline_in > playhead) {
|
||||
if (c->timeline_in < n_cut && c->timeline_in > sequence->playhead) {
|
||||
n_cut = c->timeline_in;
|
||||
seek_enabled = true;
|
||||
} else if (c->timeline_out < n_cut && c->timeline_out > playhead) {
|
||||
} else if (c->timeline_out < n_cut && c->timeline_out > sequence->playhead) {
|
||||
n_cut = c->timeline_out;
|
||||
seek_enabled = true;
|
||||
}
|
||||
@@ -145,7 +144,7 @@ void Timeline::next_cut() {
|
||||
|
||||
void Timeline::reset_all_audio() {
|
||||
// reset all clip audio
|
||||
audio_ibuffer_frame = playhead;
|
||||
audio_ibuffer_frame = sequence->playhead;
|
||||
if (sequence != NULL) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
@@ -160,7 +159,7 @@ void Timeline::reset_all_audio() {
|
||||
|
||||
void Timeline::seek(long p) {
|
||||
pause();
|
||||
playhead = p;
|
||||
sequence->playhead = p;
|
||||
reset_all_audio();
|
||||
repaint_timeline();
|
||||
}
|
||||
@@ -174,7 +173,7 @@ void Timeline::toggle_play() {
|
||||
}
|
||||
|
||||
void Timeline::play() {
|
||||
playhead_start = playhead;
|
||||
playhead_start = sequence->playhead;
|
||||
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
||||
playback_updater.start();
|
||||
playing = true;
|
||||
@@ -240,11 +239,11 @@ int Timeline::calculate_track_height(int track, int value) {
|
||||
}
|
||||
|
||||
void Timeline::set_in_point() {
|
||||
ui->headers->set_in_point(playhead);
|
||||
ui->headers->set_in_point(sequence->playhead);
|
||||
}
|
||||
|
||||
void Timeline::set_out_point() {
|
||||
ui->headers->set_out_point(playhead);
|
||||
ui->headers->set_out_point(sequence->playhead);
|
||||
}
|
||||
|
||||
void Timeline::update_sequence() {
|
||||
@@ -279,7 +278,7 @@ bool Timeline::focused() {
|
||||
|
||||
void Timeline::repaint_timeline() {
|
||||
if (playing) {
|
||||
playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * sequence->frame_rate));
|
||||
sequence->playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * sequence->frame_rate));
|
||||
}
|
||||
|
||||
ui->headers->update_header(zoom);
|
||||
@@ -287,12 +286,12 @@ void Timeline::repaint_timeline() {
|
||||
ui->audio_area->update();
|
||||
panel_effect_controls->update_keyframes();
|
||||
|
||||
if (last_frame != playhead) {
|
||||
if (last_frame != sequence->playhead) {
|
||||
panel_viewer->viewer_widget->update();
|
||||
ui->audio_monitor->update();
|
||||
last_frame = playhead;
|
||||
last_frame = sequence->playhead;
|
||||
}
|
||||
panel_viewer->update_playhead_timecode(playhead);
|
||||
panel_viewer->update_playhead_timecode(sequence->playhead);
|
||||
}
|
||||
|
||||
void Timeline::redraw_all_clips(bool changed) {
|
||||
@@ -308,7 +307,7 @@ void Timeline::redraw_all_clips(bool changed) {
|
||||
|
||||
if (zoomChanged) {
|
||||
ui->audioScrollArea->update();
|
||||
ui->audioScrollArea->horizontalScrollBar()->setValue(getTimelineScreenPointFromFrame(playhead)-(ui->audioScrollArea->width()/2));
|
||||
ui->audioScrollArea->horizontalScrollBar()->setValue(getTimelineScreenPointFromFrame(sequence->playhead)-(ui->audioScrollArea->width()/2));
|
||||
zoomChanged = false;
|
||||
}
|
||||
|
||||
@@ -319,7 +318,7 @@ void Timeline::redraw_all_clips(bool changed) {
|
||||
|
||||
void Timeline::select_all() {
|
||||
if (sequence != NULL) {
|
||||
selections.clear();
|
||||
sequence->selections.clear();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
@@ -327,7 +326,7 @@ void Timeline::select_all() {
|
||||
s.in = c->timeline_in;
|
||||
s.out = c->timeline_out;
|
||||
s.track = c->track;
|
||||
selections.append(s);
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
repaint_timeline();
|
||||
@@ -405,20 +404,20 @@ void Timeline::delete_in_out(bool ripple) {
|
||||
}
|
||||
|
||||
void Timeline::delete_selection(bool ripple_delete) {
|
||||
if (selections.size() > 0) {
|
||||
if (sequence->selections.size() > 0) {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
delete_areas_and_relink(ca, selections);
|
||||
delete_areas_and_relink(ca, sequence->selections);
|
||||
|
||||
if (ripple_delete) {
|
||||
long ripple_point = selections.at(0).in;
|
||||
long ripple_length = selections.at(0).out - selections.at(0).in;
|
||||
long ripple_point = sequence->selections.at(0).in;
|
||||
long ripple_length = sequence->selections.at(0).out - sequence->selections.at(0).in;
|
||||
|
||||
// retrieve ripple_point and ripple_length from current selection
|
||||
for (int i=1;i<selections.size();i++) {
|
||||
const Selection& s = selections.at(i);
|
||||
for (int i=1;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
ripple_point = qMin(ripple_point, s.in);
|
||||
ripple_length = qMin(ripple_length, s.out - s.in);
|
||||
}
|
||||
@@ -432,8 +431,8 @@ void Timeline::delete_selection(bool ripple_delete) {
|
||||
if (c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||
// conflict detected, but this clip may be getting deleted so let's check
|
||||
bool deleted = false;
|
||||
for (int j=0;j<selections.size();j++) {
|
||||
const Selection& s = selections.at(j);
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
if (s.track == c->track
|
||||
&& !(c->timeline_in < s.in && c->timeline_out < s.in)
|
||||
&& !(c->timeline_in > s.out && c->timeline_out > s.out)) {
|
||||
@@ -456,7 +455,7 @@ void Timeline::delete_selection(bool ripple_delete) {
|
||||
if (can_ripple) ca->append(new RippleCommand(sequence, ripple_point, -ripple_length));
|
||||
}
|
||||
|
||||
selections.clear();
|
||||
sequence->selections.clear();
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
@@ -504,8 +503,8 @@ void Timeline::on_pushButton_5_clicked()
|
||||
}
|
||||
|
||||
bool Timeline::is_clip_selected(Clip* clip, bool containing) {
|
||||
for (int i=0;i<selections.size();i++) {
|
||||
const Selection& s = selections.at(i);
|
||||
for (int i=0;i<clip->sequence->selections.size();i++) {
|
||||
const Selection& s = clip->sequence->selections.at(i);
|
||||
if (clip->track == s.track && ((clip->timeline_in >= s.in && clip->timeline_out <= s.out && containing) ||
|
||||
(!containing && !(clip->timeline_in < s.in && clip->timeline_out < s.in) && !(clip->timeline_in > s.in && clip->timeline_out > s.in)))) {
|
||||
return true;
|
||||
@@ -709,8 +708,8 @@ void Timeline::copy(bool del) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
for (int j=0;j<selections.size();j++) {
|
||||
const Selection& s = selections.at(j);
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
if (s.track == c->track && !((c->timeline_in <= s.in && c->timeline_out <= s.in) || (c->timeline_in >= s.out && c->timeline_out >= s.out))) {
|
||||
if (!cleared) {
|
||||
clip_clipboard.clear();
|
||||
@@ -785,8 +784,8 @@ void Timeline::paste() {
|
||||
|
||||
// create copy of clip and offset by playhead
|
||||
Clip* cc = c->copy(sequence);
|
||||
cc->timeline_in += playhead;
|
||||
cc->timeline_out += playhead;
|
||||
cc->timeline_in += sequence->playhead;
|
||||
cc->timeline_out += sequence->playhead;
|
||||
cc->track = c->track;
|
||||
if (cc->timeline_out > paste_end) paste_end = cc->timeline_out;
|
||||
cc->sequence = sequence;
|
||||
@@ -841,18 +840,18 @@ void Timeline::ripple_to_in_point(bool in) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
if ((in && c->timeline_in > in_point && c->timeline_in <= playhead)
|
||||
|| (!in && c->timeline_in < in_point && c->timeline_in >= playhead)) {
|
||||
if ((in && c->timeline_in > in_point && c->timeline_in <= sequence->playhead)
|
||||
|| (!in && c->timeline_in < in_point && c->timeline_in >= sequence->playhead)) {
|
||||
in_point = c->timeline_in;
|
||||
if (playhead == in_point) {
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((in && c->timeline_out > in_point && c->timeline_out <= playhead)
|
||||
|| (!in && c->timeline_out < in_point && c->timeline_out > playhead)) {
|
||||
if ((in && c->timeline_out > in_point && c->timeline_out <= sequence->playhead)
|
||||
|| (!in && c->timeline_out < in_point && c->timeline_out > sequence->playhead)) {
|
||||
in_point = c->timeline_out;
|
||||
if (playhead == in_point) {
|
||||
if (sequence->playhead == in_point) {
|
||||
one_frame_mode = true;
|
||||
break;
|
||||
}
|
||||
@@ -866,8 +865,8 @@ void Timeline::ripple_to_in_point(bool in) {
|
||||
QVector<Selection> areas;
|
||||
for (int i=track_min;i<=track_max;i++) {
|
||||
Selection s;
|
||||
s.in = qMin(in_point, playhead);
|
||||
s.out = qMax(in_point, playhead);
|
||||
s.in = qMin(in_point, sequence->playhead);
|
||||
s.out = qMax(in_point, sequence->playhead);
|
||||
s.track = i;
|
||||
areas.append(s);
|
||||
}
|
||||
@@ -875,7 +874,7 @@ void Timeline::ripple_to_in_point(bool in) {
|
||||
// trim and move clips around the in point
|
||||
ComboAction* ca = new ComboAction();
|
||||
delete_areas_and_relink(ca, areas);
|
||||
ca->append(new RippleCommand(sequence, in_point, (in) ? (in_point - playhead) : (playhead - in_point)));
|
||||
ca->append(new RippleCommand(sequence, in_point, (in) ? (in_point - sequence->playhead) : (sequence->playhead - in_point)));
|
||||
undo_stack.push(ca);
|
||||
|
||||
redraw_all_clips(true);
|
||||
@@ -897,8 +896,8 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL) {
|
||||
for (int i=0;i<selections.size();i++) {
|
||||
const Selection& s = selections.at(i);
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
if (s.track == clip->track) {
|
||||
if (clip->timeline_in < s.in && clip->timeline_out > s.out) {
|
||||
Clip* split_A = clip->copy(sequence);
|
||||
@@ -970,14 +969,14 @@ void Timeline::split_at_playhead() {
|
||||
bool split_selected = false;
|
||||
split_cache.clear();
|
||||
|
||||
if (selections.size() > 0) {
|
||||
if (sequence->selections.size() > 0) {
|
||||
// see if whole clips are selected
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL && is_clip_selected(clip, true)) {
|
||||
Clip* s = split_clip(ca, j, playhead);
|
||||
Clip* s = split_clip(ca, j, sequence->playhead);
|
||||
if (s != NULL) {
|
||||
pre_clips.append(j);
|
||||
post_clips.append(s);
|
||||
@@ -1002,7 +1001,7 @@ void Timeline::split_at_playhead() {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, playhead, true)) {
|
||||
if (split_clip_and_relink(ca, j, sequence->playhead, true)) {
|
||||
split_selected = true;
|
||||
}
|
||||
}
|
||||
@@ -1018,13 +1017,13 @@ void Timeline::split_at_playhead() {
|
||||
}
|
||||
|
||||
void Timeline::deselect_area(long in, long out, int track) {
|
||||
int len = selections.size();
|
||||
int len = sequence->selections.size();
|
||||
for (int i=0;i<len;i++) {
|
||||
Selection& s = selections[i];
|
||||
Selection& s = sequence->selections[i];
|
||||
if (s.track == track) {
|
||||
if (s.in >= in && s.out <= out) {
|
||||
// whole selection is in deselect area
|
||||
selections.removeAt(i);
|
||||
sequence->selections.removeAt(i);
|
||||
i--;
|
||||
len--;
|
||||
} else if (s.in < in && s.out > out) {
|
||||
@@ -1033,7 +1032,7 @@ void Timeline::deselect_area(long in, long out, int track) {
|
||||
new_sel.in = out;
|
||||
new_sel.out = s.out;
|
||||
new_sel.track = s.track;
|
||||
selections.append(new_sel);
|
||||
sequence->selections.append(new_sel);
|
||||
|
||||
s.out = in;
|
||||
} else if (s.in < in && s.out > in) {
|
||||
@@ -1062,7 +1061,7 @@ void Timeline::snap_to_clip(long* l, bool playhead_inclusive) {
|
||||
snapped = false;
|
||||
if (snapping) {
|
||||
if (playhead_inclusive && !playing) {
|
||||
playhead_inclusive = snap_to_point(playhead, l);
|
||||
playhead_inclusive = snap_to_point(sequence->playhead, l);
|
||||
} else {
|
||||
playhead_inclusive = false;
|
||||
}
|
||||
@@ -1141,7 +1140,7 @@ void Timeline::decrease_track_height() {
|
||||
}
|
||||
|
||||
void Timeline::deselect() {
|
||||
selections.clear();
|
||||
sequence->selections.clear();
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
|
||||
+1
-15
@@ -2,6 +2,7 @@
|
||||
#define TIMELINE_H
|
||||
|
||||
#include "ui/timelinetools.h"
|
||||
#include "project/selection.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QVector>
|
||||
@@ -59,18 +60,6 @@ struct Ghost {
|
||||
Transition* transition;
|
||||
};
|
||||
|
||||
struct Selection {
|
||||
long in;
|
||||
long out;
|
||||
int track;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
int old_track;
|
||||
|
||||
bool trim_in;
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class Timeline;
|
||||
}
|
||||
@@ -115,8 +104,6 @@ public:
|
||||
bool snap_to_point(long point, long* l);
|
||||
void snap_to_clip(long* l, bool playhead_inclusive);
|
||||
|
||||
long playhead;
|
||||
|
||||
// playback functions
|
||||
void go_to_start();
|
||||
void previous_frame();
|
||||
@@ -156,7 +143,6 @@ public:
|
||||
// selecting functions
|
||||
bool selecting;
|
||||
int selection_offset;
|
||||
QVector<Selection> selections;
|
||||
bool is_clip_selected(Clip* clip, bool containing);
|
||||
void delete_selection(bool ripple);
|
||||
void select_all();
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ void Viewer::update_sequence() {
|
||||
config.timecode_view = TIMECODE_NONDROP;
|
||||
}
|
||||
|
||||
update_playhead_timecode(panel_timeline->playhead);
|
||||
update_playhead_timecode(sequence->playhead);
|
||||
update_end_timecode();
|
||||
|
||||
ui->glViewerPane->aspect_ratio = (float) sequence->width / (float) sequence->height;
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
||||
|
||||
// send samples to audio monitor cache
|
||||
if (panel_timeline->ui->audio_monitor->sample_cache_offset == -1) {
|
||||
panel_timeline->ui->audio_monitor->sample_cache_offset = panel_timeline->playhead;
|
||||
panel_timeline->ui->audio_monitor->sample_cache_offset = sequence->playhead;
|
||||
}
|
||||
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
|
||||
long sample_cache_playhead = panel_timeline->ui->audio_monitor->sample_cache_offset + (panel_timeline->ui->audio_monitor->sample_cache.size()/channel_count);
|
||||
|
||||
@@ -111,11 +111,11 @@ void cache_clip(Clip* clip, long playhead, bool write_A, bool write_B, bool rese
|
||||
|
||||
bool get_clip_frame(Clip* c, long playhead) {
|
||||
if (c->finished_opening) {
|
||||
long sequence_clip_time = playhead - c->timeline_in + c->clip_in;
|
||||
long clip_time = refactor_frame_number(sequence_clip_time, c->sequence->frame_rate, av_q2d(c->stream->avg_frame_rate));
|
||||
|
||||
// do we need to update the texture?
|
||||
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
|
||||
long sequence_clip_time = playhead - c->timeline_in + c->clip_in;
|
||||
long clip_time = refactor_frame_number(sequence_clip_time, c->sequence->frame_rate, ms->video_frame_rate);
|
||||
|
||||
AVFrame* current_frame = NULL;
|
||||
bool no_frame = false;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
struct Selection {
|
||||
long in;
|
||||
long out;
|
||||
int track;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
int old_track;
|
||||
|
||||
bool trim_in;
|
||||
};
|
||||
|
||||
#endif // SELECTION_H
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
Sequence::Sequence() :
|
||||
playhead(0),
|
||||
using_workarea(false),
|
||||
workarea_in(0),
|
||||
workarea_out(0)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "project/marker.h"
|
||||
#include "project/selection.h"
|
||||
|
||||
struct Sequence {
|
||||
public:
|
||||
@@ -20,6 +21,9 @@ public:
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
|
||||
QVector<Selection> selections;
|
||||
long playhead;
|
||||
|
||||
bool using_workarea;
|
||||
long workarea_in;
|
||||
long workarea_out;
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
p.fillRect(r, gradient);
|
||||
|
||||
if (sample_cache_offset != -1 && sample_cache.size() > 0) {
|
||||
playhead_offset = (panel_timeline->playhead - sample_cache_offset) * channel_count;
|
||||
playhead_offset = (sequence->playhead - sample_cache_offset) * channel_count;
|
||||
if (playhead_offset >= 0 && playhead_offset < sample_cache.size()) {
|
||||
double multiplier = 1 - qAbs((double) sample_cache.at(playhead_offset+i) / 32768.0); // 16-bit int divided to float
|
||||
/*if (multiplier == (double) 0) {
|
||||
@@ -78,7 +78,7 @@ void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
if (playhead_offset > -1) {
|
||||
// clean up used samples
|
||||
bool error = false;
|
||||
while (sample_cache_offset < panel_timeline->playhead && !error) {
|
||||
while (sample_cache_offset < sequence->playhead && !error) {
|
||||
sample_cache_offset++;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
if (sample_cache.isEmpty()) {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
header->setMinimumWidth(width);
|
||||
header->set_visible_in(effects_in);
|
||||
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, panel_timeline->playhead-visible_in);
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in);
|
||||
p.setPen(Qt::red);
|
||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||
}
|
||||
|
||||
+13
-1
@@ -1,6 +1,9 @@
|
||||
#include "labelslider.h"
|
||||
|
||||
#include "project/undo.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "io/config.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QInputDialog>
|
||||
@@ -16,7 +19,12 @@ LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
|
||||
internal_value = -1;
|
||||
set_default_value(0);
|
||||
set_value(0, false);
|
||||
set = false;
|
||||
set = false;
|
||||
display_type = LABELSLIDER_NORMAL;
|
||||
}
|
||||
|
||||
void LabelSlider::set_display_type(int type) {
|
||||
display_type = type;
|
||||
}
|
||||
|
||||
void LabelSlider::set_value(double v, bool userSet) {
|
||||
@@ -44,6 +52,10 @@ bool LabelSlider::is_dragging() {
|
||||
}
|
||||
|
||||
QString LabelSlider::valueToString(double v) {
|
||||
switch (display_type) {
|
||||
case LABELSLIDER_FRAMENUMBER: return frame_to_timecode(v, config.timecode_view, sequence->frame_rate);
|
||||
case LABELSLIDER_PERCENT: return QString::number(v, 'f', 1) + "%";
|
||||
}
|
||||
return QString::number(v, 'f', 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,16 @@
|
||||
#include <QLabel>
|
||||
#include <QUndoCommand>
|
||||
|
||||
#define LABELSLIDER_NORMAL 0
|
||||
#define LABELSLIDER_FRAMENUMBER 1
|
||||
#define LABELSLIDER_PERCENT 2
|
||||
|
||||
class LabelSlider : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LabelSlider(QWidget* parent = 0);
|
||||
void set_display_type(int type);
|
||||
void set_value(double v, bool userSet);
|
||||
void set_default_value(double v);
|
||||
void set_minimum_value(double v);
|
||||
@@ -40,6 +45,8 @@ private:
|
||||
int drag_start_y;
|
||||
|
||||
bool set;
|
||||
|
||||
int display_type;
|
||||
signals:
|
||||
void valueChanged();
|
||||
};
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
|
||||
}
|
||||
|
||||
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeWidget::dragEnterEvent(event);
|
||||
|
||||
@@ -153,7 +153,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
// draw text
|
||||
if (lineX-textWidth > lastTextBoundary) {
|
||||
p.setPen(Qt::white);
|
||||
QString timecode = frame_to_timecode(frame, config.timecode_view, sequence->frame_rate);
|
||||
QString timecode = frame_to_timecode(frame + in_visible, config.timecode_view, sequence->frame_rate);
|
||||
textWidth = fm.width(timecode)>>1;
|
||||
lastTextBoundary = lineX+textWidth;
|
||||
p.drawText(QRect(lineX-textWidth, 0, lastTextBoundary, yoff), timecode);
|
||||
@@ -186,7 +186,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
}
|
||||
|
||||
// draw playhead triangle
|
||||
in_x = getScreenPointFromFrame(zoom, panel_timeline->playhead - in_visible);
|
||||
in_x = getScreenPointFromFrame(zoom, sequence->playhead - in_visible);
|
||||
QPoint start(in_x, height()+2);
|
||||
QPainterPath path;
|
||||
path.moveTo(start);
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
#define TIMELINE_TOOL_SLIDE 6
|
||||
#define TIMELINE_TOOL_HAND 7
|
||||
#define TIMELINE_TOOL_ZOOM 8
|
||||
#define TIMELINE_TOOL_MENU 9
|
||||
|
||||
#endif // TIMELINETOOLS_H
|
||||
|
||||
+198
-169
@@ -11,6 +11,7 @@
|
||||
#include "panels/effectcontrols.h"
|
||||
#include "project/undo.h"
|
||||
#include "ui_timeline.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "effects/transition.h"
|
||||
@@ -27,6 +28,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QtMath>
|
||||
#include <QScrollBar>
|
||||
#include <QMimeData>
|
||||
|
||||
#define MAX_TEXT_WIDTH 20
|
||||
|
||||
@@ -43,7 +45,26 @@ TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
QMenu menu(this);
|
||||
menu.addAction("Context menu coming soon...");
|
||||
|
||||
QAction* undoAction = menu.addAction("&Undo");
|
||||
QAction* redoAction = menu.addAction("&Redo");
|
||||
connect(undoAction, SIGNAL(triggered(bool)), mainWindow, SLOT(undo()));
|
||||
connect(redoAction, SIGNAL(triggered(bool)), mainWindow, SLOT(redo()));
|
||||
undoAction->setEnabled(undo_stack.canUndo());
|
||||
redoAction->setEnabled(undo_stack.canRedo());
|
||||
menu.addSeparator();
|
||||
|
||||
if (sequence->selections.size() == 0) {
|
||||
menu.addAction("Sequence settings coming soon...");
|
||||
} else {
|
||||
QAction* cutAction = menu.addAction("C&ut");
|
||||
QAction* copyAction = menu.addAction("Cop&y");
|
||||
QAction* pasteAction = menu.addAction("&Paste");
|
||||
menu.addSeparator();
|
||||
QAction* speedAction = menu.addAction("&Speed/Duration");
|
||||
connect(speedAction, SIGNAL(triggered(bool)), mainWindow, SLOT(openSpeedDialog()));
|
||||
}
|
||||
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
@@ -212,7 +233,10 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
|
||||
g.old_track = g.track;
|
||||
}
|
||||
panel_timeline->importing = true;
|
||||
}
|
||||
}/* else if (config.enable_drag_files_to_timeline && event->mimeData()->hasUrls()) {
|
||||
event->accept();
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
void TimelineWidget::dragMoveEvent(QDragMoveEvent *event) {
|
||||
@@ -352,12 +376,12 @@ void TimelineWidget::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
int clip_index = getClipIndexFromCoords(panel_timeline->cursor_frame, panel_timeline->cursor_track);
|
||||
if (clip_index >= 0) {
|
||||
Clip* clip = sequence->clips.at(clip_index);
|
||||
if (!(event->modifiers() & Qt::ShiftModifier)) panel_timeline->selections.clear();
|
||||
if (!(event->modifiers() & Qt::ShiftModifier)) sequence->selections.clear();
|
||||
Selection s;
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_out;
|
||||
s.track = clip->track;
|
||||
panel_timeline->selections.append(s);
|
||||
sequence->selections.append(s);
|
||||
panel_timeline->repaint_timeline();
|
||||
}
|
||||
}
|
||||
@@ -369,170 +393,175 @@ bool isLiveEditing() {
|
||||
|
||||
void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
if (sequence != NULL) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
QPoint pos = event->pos();
|
||||
if (isLiveEditing()) {
|
||||
panel_timeline->drag_frame_start = panel_timeline->cursor_frame;
|
||||
panel_timeline->drag_track_start = panel_timeline->cursor_track;
|
||||
} else {
|
||||
panel_timeline->drag_frame_start = panel_timeline->getTimelineFrameFromScreenPoint(pos.x());
|
||||
panel_timeline->drag_track_start = getTrackFromScreenPoint(pos.y());
|
||||
}
|
||||
int tool = panel_timeline->tool;
|
||||
if (event->button() == Qt::RightButton) {
|
||||
tool = TIMELINE_TOOL_MENU;
|
||||
panel_timeline->creating = false;
|
||||
}
|
||||
|
||||
int clip_index = panel_timeline->trim_target;
|
||||
if (clip_index == -1) clip_index = getClipIndexFromCoords(panel_timeline->drag_frame_start, panel_timeline->drag_track_start);
|
||||
QPoint pos = event->pos();
|
||||
if (isLiveEditing()) {
|
||||
panel_timeline->drag_frame_start = panel_timeline->cursor_frame;
|
||||
panel_timeline->drag_track_start = panel_timeline->cursor_track;
|
||||
} else {
|
||||
panel_timeline->drag_frame_start = panel_timeline->getTimelineFrameFromScreenPoint(pos.x());
|
||||
panel_timeline->drag_track_start = getTrackFromScreenPoint(pos.y());
|
||||
}
|
||||
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
int clip_index = panel_timeline->trim_target;
|
||||
if (clip_index == -1) clip_index = getClipIndexFromCoords(panel_timeline->drag_frame_start, panel_timeline->drag_track_start);
|
||||
|
||||
if (shift) {
|
||||
panel_timeline->selection_offset = panel_timeline->selections.size();
|
||||
} else {
|
||||
panel_timeline->selection_offset = 0;
|
||||
}
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
|
||||
if (panel_timeline->creating) {
|
||||
int comp = 0;
|
||||
switch (panel_timeline->creatingObject) {
|
||||
case ADD_OBJ_TITLE:
|
||||
case ADD_OBJ_SOLID:
|
||||
case ADD_OBJ_BARS:
|
||||
comp = -1;
|
||||
break;
|
||||
case ADD_OBJ_TONE:
|
||||
case ADD_OBJ_NOISE:
|
||||
comp = 1;
|
||||
break;
|
||||
}
|
||||
if (shift) {
|
||||
panel_timeline->selection_offset = sequence->selections.size();
|
||||
} else {
|
||||
panel_timeline->selection_offset = 0;
|
||||
}
|
||||
|
||||
if ((panel_timeline->drag_track_start < 0) == (comp < 0)) {
|
||||
Ghost g;
|
||||
g.in = g.old_in = g.out = g.old_out = panel_timeline->drag_frame_start;
|
||||
g.track = g.old_track = panel_timeline->drag_track_start;
|
||||
g.transition = NULL;
|
||||
g.clip = -1;
|
||||
g.trimming = true;
|
||||
g.trim_in = false;
|
||||
panel_timeline->ghosts.append(g);
|
||||
if (panel_timeline->creating) {
|
||||
int comp = 0;
|
||||
switch (panel_timeline->creatingObject) {
|
||||
case ADD_OBJ_TITLE:
|
||||
case ADD_OBJ_SOLID:
|
||||
case ADD_OBJ_BARS:
|
||||
comp = -1;
|
||||
break;
|
||||
case ADD_OBJ_TONE:
|
||||
case ADD_OBJ_NOISE:
|
||||
comp = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((panel_timeline->drag_track_start < 0) == (comp < 0)) {
|
||||
Ghost g;
|
||||
g.in = g.old_in = g.out = g.old_out = panel_timeline->drag_frame_start;
|
||||
g.track = g.old_track = panel_timeline->drag_track_start;
|
||||
g.transition = NULL;
|
||||
g.clip = -1;
|
||||
g.trimming = true;
|
||||
g.trim_in = false;
|
||||
panel_timeline->ghosts.append(g);
|
||||
|
||||
panel_timeline->moving_init = true;
|
||||
panel_timeline->moving_proc = true;
|
||||
}
|
||||
} else {
|
||||
switch (tool) {
|
||||
case TIMELINE_TOOL_POINTER:
|
||||
case TIMELINE_TOOL_RIPPLE:
|
||||
case TIMELINE_TOOL_SLIP:
|
||||
case TIMELINE_TOOL_ROLLING:
|
||||
case TIMELINE_TOOL_SLIDE:
|
||||
case TIMELINE_TOOL_MENU:
|
||||
{
|
||||
if (track_resizing && tool != TIMELINE_TOOL_MENU) {
|
||||
track_resize_mouse_cache = event->pos().y();
|
||||
panel_timeline->moving_init = true;
|
||||
panel_timeline->moving_proc = true;
|
||||
}
|
||||
} else {
|
||||
switch (panel_timeline->tool) {
|
||||
case TIMELINE_TOOL_POINTER:
|
||||
case TIMELINE_TOOL_RIPPLE:
|
||||
case TIMELINE_TOOL_SLIP:
|
||||
case TIMELINE_TOOL_ROLLING:
|
||||
case TIMELINE_TOOL_SLIDE:
|
||||
{
|
||||
if (track_resizing) {
|
||||
track_resize_mouse_cache = event->pos().y();
|
||||
panel_timeline->moving_init = true;
|
||||
} else {
|
||||
if (clip_index >= 0) {
|
||||
Clip* clip = sequence->clips.at(clip_index);
|
||||
if (clip != NULL) {
|
||||
if (panel_timeline->is_clip_selected(clip, true)) {
|
||||
if (shift) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
} else {
|
||||
if (clip_index >= 0) {
|
||||
Clip* clip = sequence->clips.at(clip_index);
|
||||
if (clip != NULL) {
|
||||
if (panel_timeline->is_clip_selected(clip, true)) {
|
||||
if (shift) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
|
||||
if (!alt) {
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (panel_timeline->transition_select != TA_NO_TRANSITION) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
|
||||
Selection s;
|
||||
s.track = clip->track;
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->opening_transition != NULL) {
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_in + clip->opening_transition->length;
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->closing_transition != NULL) {
|
||||
s.in = clip->timeline_out - clip->closing_transition->length;
|
||||
s.out = clip->timeline_out;
|
||||
}
|
||||
panel_timeline->selections.append(s);
|
||||
if (!alt) {
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if "shift" is not down
|
||||
if (!shift) {
|
||||
panel_timeline->selections.clear();
|
||||
}
|
||||
if (panel_timeline->transition_select != TA_NO_TRANSITION) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
|
||||
Selection s;
|
||||
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_out;
|
||||
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
||||
s.out = clip->timeline_in + clip->opening_transition->length;
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
||||
s.in = clip->timeline_out - clip->closing_transition->length;
|
||||
}
|
||||
|
||||
s.track = clip->track;
|
||||
panel_timeline->selections.append(s);
|
||||
|
||||
if (config.select_also_seeks) {
|
||||
panel_timeline->seek(clip->timeline_in);
|
||||
}
|
||||
|
||||
// if alt is not down, select links
|
||||
if (!alt && panel_timeline->transition_select == TA_NO_TRANSITION) {
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
if (!panel_timeline->is_clip_selected(link, true)) {
|
||||
Selection ss;
|
||||
ss.in = link->timeline_in;
|
||||
ss.out = link->timeline_out;
|
||||
ss.track = link->track;
|
||||
panel_timeline->selections.append(ss);
|
||||
}
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
|
||||
Selection s;
|
||||
s.track = clip->track;
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->opening_transition != NULL) {
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_in + clip->opening_transition->length;
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->closing_transition != NULL) {
|
||||
s.in = clip->timeline_out - clip->closing_transition->length;
|
||||
s.out = clip->timeline_out;
|
||||
}
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if "shift" is not down
|
||||
if (!shift) {
|
||||
sequence->selections.clear();
|
||||
}
|
||||
|
||||
Selection s;
|
||||
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_out;
|
||||
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
||||
s.out = clip->timeline_in + clip->opening_transition->length;
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
||||
s.in = clip->timeline_out - clip->closing_transition->length;
|
||||
}
|
||||
|
||||
s.track = clip->track;
|
||||
sequence->selections.append(s);
|
||||
|
||||
if (config.select_also_seeks) {
|
||||
panel_timeline->seek(clip->timeline_in);
|
||||
}
|
||||
|
||||
// if alt is not down, select links
|
||||
if (!alt && panel_timeline->transition_select == TA_NO_TRANSITION) {
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
if (!panel_timeline->is_clip_selected(link, true)) {
|
||||
Selection ss;
|
||||
ss.in = link->timeline_in;
|
||||
ss.out = link->timeline_out;
|
||||
ss.track = link->track;
|
||||
sequence->selections.append(ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panel_timeline->moving_init = true;
|
||||
} else {
|
||||
// if "shift" is not down
|
||||
if (!shift) {
|
||||
panel_timeline->selections.clear();
|
||||
}
|
||||
|
||||
panel_timeline->rect_select_init = true;
|
||||
}
|
||||
panel_timeline->repaint_timeline();
|
||||
|
||||
if (tool != TIMELINE_TOOL_MENU) panel_timeline->moving_init = true;
|
||||
} else {
|
||||
// if "shift" is not down
|
||||
if (!shift) {
|
||||
sequence->selections.clear();
|
||||
}
|
||||
|
||||
panel_timeline->rect_select_init = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TIMELINE_TOOL_EDIT:
|
||||
if (config.edit_tool_also_seeks) panel_timeline->seek(panel_timeline->drag_frame_start);
|
||||
panel_timeline->selecting = true;
|
||||
break;
|
||||
case TIMELINE_TOOL_RAZOR:
|
||||
{
|
||||
panel_timeline->splitting = true;
|
||||
panel_timeline->split_tracks.append(panel_timeline->drag_track_start);
|
||||
panel_timeline->repaint_timeline();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TIMELINE_TOOL_EDIT:
|
||||
if (config.edit_tool_also_seeks) panel_timeline->seek(panel_timeline->drag_frame_start);
|
||||
panel_timeline->selecting = true;
|
||||
break;
|
||||
case TIMELINE_TOOL_RAZOR:
|
||||
{
|
||||
panel_timeline->splitting = true;
|
||||
panel_timeline->split_tracks.append(panel_timeline->drag_track_start);
|
||||
panel_timeline->repaint_timeline();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -817,7 +846,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
}
|
||||
|
||||
// remove duplicate selections
|
||||
panel_timeline->clean_up_selections(panel_timeline->selections);
|
||||
panel_timeline->clean_up_selections(sequence->selections);
|
||||
|
||||
// destroy all ghosts
|
||||
panel_timeline->ghosts.clear();
|
||||
@@ -882,8 +911,8 @@ void TimelineWidget::init_ghosts() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<panel_timeline->selections.size();i++) {
|
||||
Selection& s = panel_timeline->selections[i];
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
Selection& s = sequence->selections[i];
|
||||
s.old_in = s.in;
|
||||
s.old_out = s.out;
|
||||
s.old_track = s.track;
|
||||
@@ -913,7 +942,7 @@ void validate_snapping(const Ghost& g, long* frame_diff) {
|
||||
if (panel_timeline->snapping) {
|
||||
bool snap_to_clip = true;
|
||||
if (!panel_timeline->playing) {
|
||||
snap_to_clip = !subvalidate_snapping(g, frame_diff, panel_timeline->playhead);
|
||||
snap_to_clip = !subvalidate_snapping(g, frame_diff, sequence->playhead);
|
||||
}
|
||||
if (snap_to_clip) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
@@ -1105,8 +1134,8 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
|
||||
// apply changes to selections
|
||||
if (panel_timeline->tool != TIMELINE_TOOL_SLIP && !panel_timeline->importing) {
|
||||
for (int i=0;i<panel_timeline->selections.size();i++) {
|
||||
Selection& s = panel_timeline->selections[i];
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
Selection& s = sequence->selections[i];
|
||||
if (panel_timeline->trim_target > -1) {
|
||||
if (panel_timeline->trim_in_point) {
|
||||
s.in = s.old_in + frame_diff;
|
||||
@@ -1114,8 +1143,8 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
s.out = s.old_out + frame_diff;
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<panel_timeline->selections.size();i++) {
|
||||
Selection& s = panel_timeline->selections[i];
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
Selection& s = sequence->selections[i];
|
||||
s.in = s.old_in + frame_diff;
|
||||
s.out = s.old_out + frame_diff;
|
||||
s.track = s.old_track;
|
||||
@@ -1148,12 +1177,12 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
if (panel_timeline->selecting) {
|
||||
int selection_count = 1 + qMax(panel_timeline->cursor_track, panel_timeline->drag_track_start) - qMin(panel_timeline->cursor_track, panel_timeline->drag_track_start) + panel_timeline->selection_offset;
|
||||
if (panel_timeline->selections.size() != selection_count) {
|
||||
panel_timeline->selections.resize(selection_count);
|
||||
if (sequence->selections.size() != selection_count) {
|
||||
sequence->selections.resize(selection_count);
|
||||
}
|
||||
int minimum_selection_track = qMin(panel_timeline->cursor_track, panel_timeline->drag_track_start);
|
||||
for (int i=panel_timeline->selection_offset;i<selection_count;i++) {
|
||||
Selection& s = panel_timeline->selections[i];
|
||||
Selection& s = sequence->selections[i];
|
||||
s.track = minimum_selection_track + i - panel_timeline->selection_offset;
|
||||
long in = panel_timeline->drag_frame_start;
|
||||
long out = panel_timeline->cursor_frame;
|
||||
@@ -1165,8 +1194,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (config.edit_tool_selects_links) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
for (int k=0;k<panel_timeline->selections.size();k++) {
|
||||
const Selection& s = panel_timeline->selections.at(k);
|
||||
for (int k=0;k<sequence->selections.size();k++) {
|
||||
const Selection& s = sequence->selections.at(k);
|
||||
if (!(c->timeline_in < s.in && c->timeline_out < s.in) &&
|
||||
!(c->timeline_in > s.out && c->timeline_out > s.out) &&
|
||||
c->track == s.track) {
|
||||
@@ -1174,8 +1203,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
QVector<int> linked_tracks = panel_timeline->get_tracks_of_linked_clips(j);
|
||||
for (int k=0;k<linked_tracks.size();k++) {
|
||||
bool found = false;
|
||||
for (int l=0;l<panel_timeline->selections.size();l++) {
|
||||
const Selection& test_sel = panel_timeline->selections.at(l);
|
||||
for (int l=0;l<sequence->selections.size();l++) {
|
||||
const Selection& test_sel = sequence->selections.at(l);
|
||||
if (test_sel.track == linked_tracks.at(k) &&
|
||||
test_sel.in == s.in &&
|
||||
test_sel.out == s.out) {
|
||||
@@ -1185,7 +1214,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
if (!found) {
|
||||
Selection link_sel = {s.in, s.out, linked_tracks.at(k)};
|
||||
panel_timeline->selections.append(link_sel);
|
||||
sequence->selections.append(link_sel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1229,8 +1258,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
// if a whole clip is not selected, maybe just a transition is
|
||||
if (!add && panel_timeline->tool == TIMELINE_TOOL_POINTER && (c->opening_transition != NULL || c->closing_transition != NULL)) {
|
||||
// check if any selections contain the whole clip or transition
|
||||
for (int j=0;j<panel_timeline->selections.size();j++) {
|
||||
const Selection& s = panel_timeline->selections.at(j);
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
if (s.track == c->track) {
|
||||
if (c->opening_transition != NULL
|
||||
&& s.in == c->timeline_in
|
||||
@@ -1472,9 +1501,9 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
panel_timeline->selections.resize(selected_clips.size() + panel_timeline->selection_offset);
|
||||
sequence->selections.resize(selected_clips.size() + panel_timeline->selection_offset);
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Selection& s = panel_timeline->selections[i+panel_timeline->selection_offset];
|
||||
Selection& s = sequence->selections[i+panel_timeline->selection_offset];
|
||||
Clip* clip = selected_clips.at(i);
|
||||
s.old_in = s.in = clip->timeline_in;
|
||||
s.old_out = s.out = clip->timeline_out;
|
||||
@@ -1851,8 +1880,8 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
p.drawPixmap(0, 0, clip_pixmap.width(), height(), clip_pixmap);
|
||||
|
||||
// Draw selections
|
||||
for (int i=0;i<panel_timeline->selections.size();i++) {
|
||||
const Selection& s = panel_timeline->selections.at(i);
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
if (is_track_visible(s.track)) {
|
||||
int selection_y = getScreenPointFromTrack(s.track);
|
||||
int selection_x = panel_timeline->getTimelineScreenPointFromFrame(s.in);
|
||||
@@ -1901,7 +1930,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
|
||||
// Draw playhead
|
||||
p.setPen(Qt::red);
|
||||
int playhead_x = panel_timeline->getTimelineScreenPointFromFrame(panel_timeline->playhead);
|
||||
int playhead_x = panel_timeline->getTimelineScreenPointFromFrame(sequence->playhead);
|
||||
p.drawLine(playhead_x, rect().top(), playhead_x, rect().bottom());
|
||||
|
||||
// draw border
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ GLuint ViewerWidget::draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture) {
|
||||
|
||||
GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
Sequence* s = sequence;
|
||||
long playhead = panel_timeline->playhead;
|
||||
long playhead = sequence->playhead;
|
||||
|
||||
if (nest != NULL) {
|
||||
s = static_cast<Sequence*>(nest->media);
|
||||
@@ -306,7 +306,7 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
if (e->is_enabled()) {
|
||||
double timecode = ((double)(panel_timeline->playhead-c->timeline_in+c->clip_in)/(double)sequence->frame_rate);
|
||||
double timecode = ((double)(sequence->playhead-c->timeline_in+c->clip_in)/(double)sequence->frame_rate);
|
||||
if (e->enable_coords) {
|
||||
e->process_coords(timecode, coords);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user