some refactoring work

This commit is contained in:
itsmattkc
2019-02-19 02:28:50 -08:00
parent ee967294ea
commit 7efea428c7
14 changed files with 223 additions and 218 deletions
+1 -1
View File
@@ -457,7 +457,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES. # normally produced when WARNINGS is set to YES.
# The default value is: NO. # The default value is: NO.
EXTRACT_ALL = NO EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation. # be included in the documentation.
+6 -6
View File
@@ -43,7 +43,7 @@ Config::Config()
img_seq_formats("jpg|jpeg|bmp|tiff|tif|psd|png|tga|jp2|gif"), img_seq_formats("jpg|jpeg|bmp|tiff|tif|psd|png|tga|jp2|gif"),
rectified_waveforms(false), rectified_waveforms(false),
default_transition_length(30), default_transition_length(30),
timecode_view(TIMECODE_DROP), timecode_view(olive::kTimecodeDrop),
show_title_safe_area(false), show_title_safe_area(false),
use_custom_title_safe_ratio(false), use_custom_title_safe_ratio(false),
custom_title_safe_ratio(1), custom_title_safe_ratio(1),
@@ -53,17 +53,17 @@ Config::Config()
enable_seek_to_import(false), enable_seek_to_import(false),
enable_audio_scrubbing(true), enable_audio_scrubbing(true),
drop_on_media_to_replace(true), drop_on_media_to_replace(true),
autoscroll(AUTOSCROLL_PAGE_SCROLL), autoscroll(olive::AUTOSCROLL_PAGE_SCROLL),
audio_rate(48000), audio_rate(48000),
fast_seeking(false), fast_seeking(false),
hover_focus(false), hover_focus(false),
project_view_type(PROJECT_VIEW_TREE), project_view_type(olive::PROJECT_VIEW_TREE),
set_name_with_marker(true), set_name_with_marker(true),
show_project_toolbar(false), show_project_toolbar(false),
previous_queue_size(3), previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES), previous_queue_type(olive::FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5), upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS), upcoming_queue_type(olive::FRAME_QUEUE_TYPE_SECONDS),
loop(false), loop(false),
seek_also_selects(false), seek_also_selects(false),
effect_textbox_lines(3), effect_textbox_lines(3),
@@ -234,7 +234,7 @@ void Config::save(QString path) {
stream.writeStartDocument(); // doc stream.writeStartDocument(); // doc
stream.writeStartElement("Configuration"); // configuration stream.writeStartElement("Configuration"); // configuration
stream.writeTextElement("Version", QString::number(SAVE_VERSION)); stream.writeTextElement("Version", QString::number(olive::kSaveVersion));
stream.writeTextElement("SavedLayout", QString::number(saved_layout)); stream.writeTextElement("SavedLayout", QString::number(saved_layout));
stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines)); stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines));
stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms)); stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms));
+28 -25
View File
@@ -23,36 +23,39 @@
#include <QString> #include <QString>
#define SAVE_VERSION 190219 // YYMMDD namespace olive {
#define MIN_SAVE_VERSION 190219 // lowest compatible project version const int kSaveVersion = 190219; // YYMMDD
const int kMinimumSaveVersion = 190219; // lowest compatible project version
enum TimecodeType { enum TimecodeType {
TIMECODE_DROP, kTimecodeDrop,
TIMECODE_NONDROP, kTimecodeNonDrop,
TIMECODE_FRAMES, kTimecodeFrames,
TIMECODE_MILLISECONDS kTimecodeMilliseconds
}; };
enum RecordingMode { enum RecordingMode {
RECORD_MODE_MONO, RECORD_MODE_MONO,
RECORD_MODE_STEREO RECORD_MODE_STEREO
}; };
enum AutoScrollMode { enum AutoScrollMode {
AUTOSCROLL_NO_SCROLL, AUTOSCROLL_NO_SCROLL,
AUTOSCROLL_PAGE_SCROLL, AUTOSCROLL_PAGE_SCROLL,
AUTOSCROLL_SMOOTH_SCROLL AUTOSCROLL_SMOOTH_SCROLL
}; };
enum ProjectView { enum ProjectView {
PROJECT_VIEW_TREE, PROJECT_VIEW_TREE,
PROJECT_VIEW_ICON PROJECT_VIEW_ICON
}; };
enum FrameQueueType {
FRAME_QUEUE_TYPE_FRAMES,
FRAME_QUEUE_TYPE_SECONDS
};
}
enum FrameQueueType {
FRAME_QUEUE_TYPE_FRAMES,
FRAME_QUEUE_TYPE_SECONDS
};
struct Config { struct Config {
Config(); Config();
+2 -2
View File
@@ -169,14 +169,14 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
show_err = true; show_err = true;
int proj_version = SAVE_VERSION; int proj_version = olive::kSaveVersion;
while (!stream.atEnd() && !cancelled) { while (!stream.atEnd() && !cancelled) {
read_next_start_element(stream); read_next_start_element(stream);
if (stream.name() == root_search) { if (stream.name() == root_search) {
if (type == LOAD_TYPE_VERSION) { if (type == LOAD_TYPE_VERSION) {
proj_version = stream.readElementText().toInt(); proj_version = stream.readElementText().toInt();
if (proj_version < MIN_SAVE_VERSION || proj_version > SAVE_VERSION) { if (proj_version < olive::kMinimumSaveVersion || proj_version > olive::kSaveVersion) {
emit start_question( emit start_question(
tr("Version Mismatch"), tr("Version Mismatch"),
tr("This project was saved in a different version of Olive and may not be fully compatible with this version. Would you like to attempt loading it anyway?"), tr("This project was saved in a different version of Olive and may not be fully compatible with this version. Would you like to attempt loading it anyway?"),
+7 -7
View File
@@ -449,19 +449,19 @@ void MainWindow::setup_menus() {
frames_action = view_menu->addAction(tr("Frames"), &olive::MenuHelper, SLOT(set_timecode_view())); frames_action = view_menu->addAction(tr("Frames"), &olive::MenuHelper, SLOT(set_timecode_view()));
frames_action->setProperty("id", "modeframes"); frames_action->setProperty("id", "modeframes");
frames_action->setData(TIMECODE_FRAMES); frames_action->setData(olive::kTimecodeFrames);
frames_action->setCheckable(true); frames_action->setCheckable(true);
drop_frame_action = view_menu->addAction(tr("Drop Frame"), &olive::MenuHelper, SLOT(set_timecode_view())); drop_frame_action = view_menu->addAction(tr("Drop Frame"), &olive::MenuHelper, SLOT(set_timecode_view()));
drop_frame_action->setProperty("id", "modedropframe"); drop_frame_action->setProperty("id", "modedropframe");
drop_frame_action->setData(TIMECODE_DROP); drop_frame_action->setData(olive::kTimecodeDrop);
drop_frame_action->setCheckable(true); drop_frame_action->setCheckable(true);
nondrop_frame_action = view_menu->addAction(tr("Non-Drop Frame"), &olive::MenuHelper, SLOT(set_timecode_view())); nondrop_frame_action = view_menu->addAction(tr("Non-Drop Frame"), &olive::MenuHelper, SLOT(set_timecode_view()));
nondrop_frame_action->setProperty("id", "modenondropframe"); nondrop_frame_action->setProperty("id", "modenondropframe");
nondrop_frame_action->setData(TIMECODE_NONDROP); nondrop_frame_action->setData(olive::kTimecodeNonDrop);
nondrop_frame_action->setCheckable(true); nondrop_frame_action->setCheckable(true);
milliseconds_action = view_menu->addAction(tr("Milliseconds"), &olive::MenuHelper, SLOT(set_timecode_view())); milliseconds_action = view_menu->addAction(tr("Milliseconds"), &olive::MenuHelper, SLOT(set_timecode_view()));
milliseconds_action->setProperty("id", "milliseconds"); milliseconds_action->setProperty("id", "milliseconds");
milliseconds_action->setData(TIMECODE_MILLISECONDS); milliseconds_action->setData(olive::kTimecodeMilliseconds);
milliseconds_action->setCheckable(true); milliseconds_action->setCheckable(true);
view_menu->addSeparator(); view_menu->addSeparator();
@@ -700,17 +700,17 @@ void MainWindow::setup_menus() {
no_autoscroll = tools_menu->addAction(tr("No Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll())); no_autoscroll = tools_menu->addAction(tr("No Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll()));
no_autoscroll->setProperty("id", "autoscrollno"); no_autoscroll->setProperty("id", "autoscrollno");
no_autoscroll->setData(AUTOSCROLL_NO_SCROLL); no_autoscroll->setData(olive::AUTOSCROLL_NO_SCROLL);
no_autoscroll->setCheckable(true); no_autoscroll->setCheckable(true);
page_autoscroll = tools_menu->addAction(tr("Page Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll())); page_autoscroll = tools_menu->addAction(tr("Page Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll()));
page_autoscroll->setProperty("id", "autoscrollpage"); page_autoscroll->setProperty("id", "autoscrollpage");
page_autoscroll->setData(AUTOSCROLL_PAGE_SCROLL); page_autoscroll->setData(olive::AUTOSCROLL_PAGE_SCROLL);
page_autoscroll->setCheckable(true); page_autoscroll->setCheckable(true);
smooth_autoscroll = tools_menu->addAction(tr("Smooth Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll())); smooth_autoscroll = tools_menu->addAction(tr("Smooth Auto-Scroll"), &olive::MenuHelper, SLOT(set_autoscroll()));
smooth_autoscroll->setProperty("id", "autoscrollsmooth"); smooth_autoscroll->setProperty("id", "autoscrollsmooth");
smooth_autoscroll->setData(AUTOSCROLL_SMOOTH_SCROLL); smooth_autoscroll->setData(olive::AUTOSCROLL_SMOOTH_SCROLL);
smooth_autoscroll->setCheckable(true); smooth_autoscroll->setCheckable(true);
tools_menu->addSeparator(); tools_menu->addSeparator();
+12 -12
View File
@@ -432,10 +432,10 @@ void Project::new_folder() {
QModelIndex index = olive::project_model.create_index(m->row(), 0, m); QModelIndex index = olive::project_model.create_index(m->row(), 0, m);
switch (olive::CurrentConfig.project_view_type) { switch (olive::CurrentConfig.project_view_type) {
case PROJECT_VIEW_TREE: case olive::PROJECT_VIEW_TREE:
tree_view->edit(sorter->mapFromSource(index)); tree_view->edit(sorter->mapFromSource(index));
break; break;
case PROJECT_VIEW_ICON: case olive::PROJECT_VIEW_ICON:
icon_view->edit(sorter->mapFromSource(index)); icon_view->edit(sorter->mapFromSource(index));
break; break;
} }
@@ -871,7 +871,7 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
// retrieve its parent item // retrieve its parent item
QModelIndex hierarchy = sorted_index.parent(); QModelIndex hierarchy = sorted_index.parent();
if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) { if (olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_TREE) {
// if we're in tree view, expand every folder in the hierarchy containing the media // if we're in tree view, expand every folder in the hierarchy containing the media
while (hierarchy.isValid()) { while (hierarchy.isValid()) {
@@ -886,7 +886,7 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
); );
tree_view->selectionModel()->select(row_select, QItemSelectionModel::Select); tree_view->selectionModel()->select(row_select, QItemSelectionModel::Select);
} else if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_ICON) { } else if (olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_ICON) {
// if we're in icon view, we just "browse" to the parent folder // if we're in icon view, we just "browse" to the parent folder
icon_view->setRootIndex(hierarchy); icon_view->setRootIndex(hierarchy);
@@ -1206,7 +1206,7 @@ void Project::save_project(bool autorecovery) {
stream.writeStartElement("project"); // project stream.writeStartElement("project"); // project
stream.writeTextElement("version", QString::number(SAVE_VERSION)); stream.writeTextElement("version", QString::number(olive::kSaveVersion));
stream.writeTextElement("url", olive::ActiveProjectFilename); stream.writeTextElement("url", olive::ActiveProjectFilename);
proj_dir = QFileInfo(olive::ActiveProjectFilename).absoluteDir(); proj_dir = QFileInfo(olive::ActiveProjectFilename).absoluteDir();
@@ -1240,26 +1240,26 @@ void Project::save_project(bool autorecovery) {
} }
void Project::update_view_type() { void Project::update_view_type() {
tree_view->setVisible(olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE); tree_view->setVisible(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_TREE);
icon_view_container->setVisible(olive::CurrentConfig.project_view_type == PROJECT_VIEW_ICON); icon_view_container->setVisible(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_ICON);
switch (olive::CurrentConfig.project_view_type) { switch (olive::CurrentConfig.project_view_type) {
case PROJECT_VIEW_TREE: case olive::PROJECT_VIEW_TREE:
sources_common->view = tree_view; sources_common->view = tree_view;
break; break;
case PROJECT_VIEW_ICON: case olive::PROJECT_VIEW_ICON:
sources_common->view = icon_view; sources_common->view = icon_view;
break; break;
} }
} }
void Project::set_icon_view() { void Project::set_icon_view() {
olive::CurrentConfig.project_view_type = PROJECT_VIEW_ICON; olive::CurrentConfig.project_view_type = olive::PROJECT_VIEW_ICON;
update_view_type(); update_view_type();
} }
void Project::set_tree_view() { void Project::set_tree_view() {
olive::CurrentConfig.project_view_type = PROJECT_VIEW_TREE; olive::CurrentConfig.project_view_type = olive::PROJECT_VIEW_TREE;
update_view_type(); update_view_type();
} }
@@ -1343,7 +1343,7 @@ QVector<Media*> Project::list_all_project_sequences() {
} }
QModelIndexList Project::get_current_selected() { QModelIndexList Project::get_current_selected() {
if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) { if (olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_TREE) {
return tree_view->selectionModel()->selectedRows(); return tree_view->selectionModel()->selectedRows();
} }
return icon_view->selectionModel()->selectedIndexes(); return icon_view->selectionModel()->selectedIndexes();
+2 -2
View File
@@ -502,13 +502,13 @@ void Timeline::repaint_timeline() {
&& panel_sequence_viewer->playing && panel_sequence_viewer->playing
&& !zoom_just_changed) { && !zoom_just_changed) {
// auto scroll // auto scroll
if (olive::CurrentConfig.autoscroll == AUTOSCROLL_PAGE_SCROLL) { if (olive::CurrentConfig.autoscroll == olive::AUTOSCROLL_PAGE_SCROLL) {
int playhead_x = getTimelineScreenPointFromFrame(olive::ActiveSequence->playhead); int playhead_x = getTimelineScreenPointFromFrame(olive::ActiveSequence->playhead);
if (playhead_x < 0 || playhead_x > (editAreas->width() - videoScrollbar->width())) { if (playhead_x < 0 || playhead_x > (editAreas->width() - videoScrollbar->width())) {
horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, olive::ActiveSequence->playhead)); horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, olive::ActiveSequence->playhead));
draw = false; draw = false;
} }
} else if (olive::CurrentConfig.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) { } else if (olive::CurrentConfig.autoscroll == olive::AUTOSCROLL_SMOOTH_SCROLL) {
if (center_scroll_to_playhead(horizontalScrollBar, zoom, olive::ActiveSequence->playhead)) { if (center_scroll_to_playhead(horizontalScrollBar, zoom, olive::ActiveSequence->playhead)) {
draw = false; draw = false;
} }
+16 -16
View File
@@ -144,14 +144,14 @@ void Viewer::reset_all_audio() {
long timecode_to_frame(const QString& s, int view, double frame_rate) { long timecode_to_frame(const QString& s, int view, double frame_rate) {
QList<QString> list = s.split(QRegExp("[:;]")); QList<QString> list = s.split(QRegExp("[:;]"));
if (view == TIMECODE_FRAMES || (list.size() == 1 && view != TIMECODE_MILLISECONDS)) { if (view == olive::kTimecodeFrames || (list.size() == 1 && view != olive::kTimecodeMilliseconds)) {
return s.toLong(); return s.toLong();
} }
int frRound = qRound(frame_rate); int frRound = qRound(frame_rate);
int hours, minutes, seconds, frames; int hours, minutes, seconds, frames;
if (view == TIMECODE_MILLISECONDS) { if (view == olive::kTimecodeMilliseconds) {
long milliseconds = s.toLong(); long milliseconds = s.toLong();
hours = milliseconds/3600000; hours = milliseconds/3600000;
@@ -174,14 +174,14 @@ long timecode_to_frame(const QString& s, int view, double frame_rate) {
int f = (frames + seconds + minutes + hours); int f = (frames + seconds + minutes + hours);
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) { if ((view == olive::kTimecodeDrop || view == olive::kTimecodeMilliseconds) && frame_rate_is_droppable(frame_rate)) {
// return drop // return drop
int d; int d;
int m; int m;
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate int dropFrames = qRound(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes int framesPer10Minutes = qRound(frame_rate * 60 * 10); //Number of frames per ten minutes
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames int framesPerMinute = (qRound(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
d = f / framesPer10Minutes; d = f / framesPer10Minutes;
f -= dropFrames*9*d; f -= dropFrames*9*d;
@@ -198,7 +198,7 @@ long timecode_to_frame(const QString& s, int view, double frame_rate) {
} }
QString frame_to_timecode(long f, int view, double frame_rate) { QString frame_to_timecode(long f, int view, double frame_rate) {
if (view == TIMECODE_FRAMES) { if (view == olive::kTimecodeFrames) {
return QString::number(f); return QString::number(f);
} }
@@ -209,7 +209,7 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
int frames = 0; int frames = 0;
QString token = ":"; QString token = ":";
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) { if ((view == olive::kTimecodeDrop || view == olive::kTimecodeMilliseconds) && frame_rate_is_droppable(frame_rate)) {
//CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE //CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE
//Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team //Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team
//Given an int called framenumber and a double called framerate //Given an int called framenumber and a double called framerate
@@ -218,11 +218,11 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
int d; int d;
int m; int m;
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate int dropFrames = qRound(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
int framesPerHour = round(frame_rate*60*60); //Number of frqRound64ames in an hour int framesPerHour = qRound(frame_rate*60*60); //Number of frqRound64ames in an hour
int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes int framesPer10Minutes = qRound(frame_rate * 60 * 10); //Number of frames per ten minutes
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames int framesPerMinute = (qRound(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
//If framenumber is greater than 24 hrs, next operation will rollover clock //If framenumber is greater than 24 hrs, next operation will rollover clock
f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b
@@ -237,7 +237,7 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
f = f + dropFrames*9*d; f = f + dropFrames*9*d;
} }
int frRound = round(frame_rate); int frRound = qRound(frame_rate);
frames = f % frRound; frames = f % frRound;
secs = (f / frRound) % 60; secs = (f / frRound) % 60;
mins = ((f / frRound) / 60) % 60; mins = ((f / frRound) / 60) % 60;
@@ -253,7 +253,7 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
secs = f/int_fps % 60; secs = f/int_fps % 60;
frames = f%int_fps; frames = f%int_fps;
} }
if (view == TIMECODE_MILLISECONDS) { if (view == olive::kTimecodeMilliseconds) {
return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate)); return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate));
} }
return QString(QString::number(hours).rightJustified(2, '0') + return QString(QString::number(hours).rightJustified(2, '0') +
@@ -263,8 +263,8 @@ QString frame_to_timecode(long f, int view, double frame_rate) {
); );
} }
bool frame_rate_is_droppable(float rate) { bool frame_rate_is_droppable(double rate) {
return (qFuzzyCompare(rate, 23.976f) || qFuzzyCompare(rate, 29.97f) || qFuzzyCompare(rate, 59.94f)); return (qFuzzyCompare(rate, 23.976) || qFuzzyCompare(rate, 29.97) || qFuzzyCompare(rate, 59.94));
} }
void Viewer::seek(long p) { void Viewer::seek(long p) {
+1 -1
View File
@@ -36,7 +36,7 @@
#include "ui/labelslider.h" #include "ui/labelslider.h"
#include "ui/resizablescrollbar.h" #include "ui/resizablescrollbar.h"
bool frame_rate_is_droppable(float rate); bool frame_rate_is_droppable(double rate);
long timecode_to_frame(const QString& s, int view, double frame_rate); long timecode_to_frame(const QString& s, int view, double frame_rate);
QString frame_to_timecode(long f, int view, double frame_rate); QString frame_to_timecode(long f, int view, double frame_rate);
+2 -2
View File
@@ -743,12 +743,12 @@ void open_clip_worker(ClipPtr clip) {
clip->max_queue_size = 1; clip->max_queue_size = 1;
} else { } else {
clip->max_queue_size = 0; clip->max_queue_size = 0;
if (olive::CurrentConfig.upcoming_queue_type == FRAME_QUEUE_TYPE_FRAMES) { if (olive::CurrentConfig.upcoming_queue_type == olive::FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(olive::CurrentConfig.upcoming_queue_size); clip->max_queue_size += qCeil(olive::CurrentConfig.upcoming_queue_size);
} else { } else {
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.upcoming_queue_size); clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.upcoming_queue_size);
} }
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { if (olive::CurrentConfig.previous_queue_type == olive::FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(olive::CurrentConfig.previous_queue_size); clip->max_queue_size += qCeil(olive::CurrentConfig.previous_queue_size);
} else { } else {
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.previous_queue_size); clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.previous_queue_size);
+3 -3
View File
@@ -204,7 +204,7 @@ void get_clip_frame(ClipPtr c, long playhead, bool& texture_failed) {
int64_t minimum_ts = target_frame->pts; int64_t minimum_ts = target_frame->pts;
int previous_frame_count = 0; int previous_frame_count = 0;
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { if (olive::CurrentConfig.previous_queue_type == olive::FRAME_QUEUE_TYPE_SECONDS) {
minimum_ts -= (second_pts*olive::CurrentConfig.previous_queue_size); minimum_ts -= (second_pts*olive::CurrentConfig.previous_queue_size);
} }
@@ -214,7 +214,7 @@ void get_clip_frame(ClipPtr c, long playhead, bool& texture_failed) {
next_pts = c->queue.at(i)->pts; next_pts = c->queue.at(i)->pts;
} }
if (c->queue.at(i) != target_frame && ((c->queue.at(i)->pts > minimum_ts) == c->reverse)) { if (c->queue.at(i) != target_frame && ((c->queue.at(i)->pts > minimum_ts) == c->reverse)) {
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { if (olive::CurrentConfig.previous_queue_type == olive::FRAME_QUEUE_TYPE_SECONDS) {
//dout << "removed frame at" << i << "because its pts was" << c->queue.at(i)->pts << "compared to" << target_frame->pts; //dout << "removed frame at" << i << "because its pts was" << c->queue.at(i)->pts << "compared to" << target_frame->pts;
av_frame_free(&c->queue[i]); // may be a little heavy for the main thread? av_frame_free(&c->queue[i]); // may be a little heavy for the main thread?
c->queue.removeAt(i); c->queue.removeAt(i);
@@ -226,7 +226,7 @@ void get_clip_frame(ClipPtr c, long playhead, bool& texture_failed) {
} }
} }
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { if (olive::CurrentConfig.previous_queue_type == olive::FRAME_QUEUE_TYPE_FRAMES) {
while (previous_frame_count > qCeil(olive::CurrentConfig.previous_queue_size)) { while (previous_frame_count > qCeil(olive::CurrentConfig.previous_queue_size)) {
int smallest = 0; int smallest = 0;
for (int i=1;i<c->queue.size();i++) { for (int i=1;i<c->queue.size();i++) {
+63 -64
View File
@@ -30,8 +30,6 @@
#include "panels/timeline.h" #include "panels/timeline.h"
#include "panels/viewer.h" #include "panels/viewer.h"
#include "project/sequence.h" #include "project/sequence.h"
#include "project/effectrow.h"
#include "project/effectfield.h"
#include "ui/keyframedrawing.h" #include "ui/keyframedrawing.h"
#include "project/undo.h" #include "project/undo.h"
#include "project/effect.h" #include "project/effect.h"
@@ -40,14 +38,15 @@
#include "debug.h" #include "debug.h"
#define GRAPH_ZOOM_SPEED 0.05
#define GRAPH_SIZE 100
#define BEZIER_HANDLE_SIZE 3
#define BEZIER_LINE_SIZE 2
#define BEZIER_HANDLE_NONE 1 const double kGraphZoomSpeed = 0.05;
#define BEZIER_HANDLE_PRE 2 const int kGraphSize = 100;
#define BEZIER_HANDLE_POST 3 const int kBezierHandleSize = 3;
const int kBezierLineSize = 2;
const int kBezierHandleNone = 1;
const int kBezierHandlePre = 2;
const int kBezierHandlePost = 3;
QColor get_curve_color(int index, int length) { QColor get_curve_color(int index, int length) {
QColor c; QColor c;
@@ -56,20 +55,20 @@ QColor get_curve_color(int index, int length) {
return c; return c;
} }
GraphView::GraphView(QWidget* parent) : GraphView::GraphView(QWidget* parent) : QWidget(parent)
QWidget(parent),
x_scroll(0),
y_scroll(0),
mousedown(false),
x_zoom(1.0),
y_zoom(1.0),
row(nullptr),
moved_keys(false),
current_handle(BEZIER_HANDLE_NONE),
rect_select(false),
visible_in(0),
click_add_proc(false)
{ {
x_scroll = 0;
y_scroll = 0;
mousedown = false;
x_zoom = 1.0;
y_zoom = 1.0;
row = nullptr;
moved_keys = false;
current_handle = kBezierHandleNone;
rect_select = false;
visible_in = 0;
click_add_proc = false;
setMouseTracking(true); setMouseTracking(true);
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
@@ -176,7 +175,7 @@ void GraphView::set_view_to_rect(int x1, double y1, int x2, double y2) {
void GraphView::draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos) { void GraphView::draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos) {
// draws last line's text // draws last line's text
QString str = QString::number(line_no*GRAPH_SIZE); QString str = QString::number(line_no*kGraphSize);
int text_sz = vert ? fontMetrics().height() : fontMetrics().width(str); int text_sz = vert ? fontMetrics().height() : fontMetrics().width(str);
if (text_sz < (next_line_pos - line_pos)) { if (text_sz < (next_line_pos - line_pos)) {
QRect text_rect = vert ? QRect(0, line_pos-50, 50, 50) : QRect(line_pos, height()-50, 50, 50); QRect text_rect = vert ? QRect(0, line_pos-50, 50, 50) : QRect(line_pos, height()-50, 50, 50);
@@ -191,7 +190,7 @@ void GraphView::draw_lines(QPainter& p, bool vert) {
int scroll = vert ? y_scroll : x_scroll; int scroll = vert ? y_scroll : x_scroll;
for (int i=0;i<lim;i++) { for (int i=0;i<lim;i++) {
int scroll_offs = vert ? height() - i + scroll : i + scroll; int scroll_offs = vert ? height() - i + scroll : i + scroll;
int this_line = qFloor(scroll_offs/(GRAPH_SIZE*(vert ? y_zoom : x_zoom))); int this_line = qFloor(scroll_offs/(kGraphSize*(vert ? y_zoom : x_zoom)));
if (vert) this_line++; if (vert) this_line++;
if (this_line != last_line) { if (this_line != last_line) {
if (vert) { if (vert) {
@@ -241,7 +240,7 @@ void GraphView::paintEvent(QPaintEvent *) {
// draw keyframes // draw keyframes
if (row != nullptr) { if (row != nullptr) {
QPen line_pen; QPen line_pen;
line_pen.setWidth(BEZIER_LINE_SIZE); line_pen.setWidth(kBezierLineSize);
for (int i=row->fieldCount()-1;i>=0;i--) { for (int i=row->fieldCount()-1;i>=0;i--) {
EffectField* field = row->field(i); EffectField* field = row->field(i);
@@ -321,12 +320,12 @@ void GraphView::paintEvent(QPaintEvent *) {
// pre handle line // pre handle line
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom); QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
p.drawLine(pre_point, QPointF(key_x, key_y)); p.drawLine(pre_point, QPointF(key_x, key_y));
p.drawEllipse(pre_point, BEZIER_HANDLE_SIZE, BEZIER_HANDLE_SIZE); p.drawEllipse(pre_point, kBezierHandleSize, kBezierHandleSize);
// post handle line // post handle line
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom); QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
p.drawLine(post_point, QPointF(key_x, key_y)); p.drawLine(post_point, QPointF(key_x, key_y));
p.drawEllipse(post_point, BEZIER_HANDLE_SIZE, BEZIER_HANDLE_SIZE); p.drawEllipse(post_point, kBezierHandleSize, kBezierHandleSize);
} }
bool selected = false; bool selected = false;
@@ -371,7 +370,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
// selecting // selecting
int sel_key = -1; int sel_key = -1;
int sel_key_field = -1; int sel_key_field = -1;
current_handle = BEZIER_HANDLE_NONE; current_handle = kBezierHandleNone;
if (click_add && (event->buttons() & Qt::LeftButton)) { if (click_add && (event->buttons() & Qt::LeftButton)) {
selected_keys.clear(); selected_keys.clear();
@@ -404,19 +403,19 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
// selecting a handle // selecting a handle
QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom); QPointF pre_point(key_x + key.pre_handle_x*x_zoom, key_y - key.pre_handle_y*y_zoom);
QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom); QPointF post_point(key_x + key.post_handle_x*x_zoom, key_y - key.post_handle_y*y_zoom);
if (event->pos().x() > pre_point.x()-BEZIER_HANDLE_SIZE if (event->pos().x() > pre_point.x()-kBezierHandleSize
&& event->pos().x() < pre_point.x()+BEZIER_HANDLE_SIZE && event->pos().x() < pre_point.x()+kBezierHandleSize
&& event->pos().y() > pre_point.y()-BEZIER_HANDLE_SIZE && event->pos().y() > pre_point.y()-kBezierHandleSize
&& event->pos().y() < pre_point.y()+BEZIER_HANDLE_SIZE) { && event->pos().y() < pre_point.y()+kBezierHandleSize) {
current_handle = BEZIER_HANDLE_PRE; current_handle = kBezierHandlePre;
} else if (event->pos().x() > post_point.x()-BEZIER_HANDLE_SIZE } else if (event->pos().x() > post_point.x()-kBezierHandleSize
&& event->pos().x() < post_point.x()+BEZIER_HANDLE_SIZE && event->pos().x() < post_point.x()+kBezierHandleSize
&& event->pos().y() > post_point.y()-BEZIER_HANDLE_SIZE && event->pos().y() > post_point.y()-kBezierHandleSize
&& event->pos().y() < post_point.y()+BEZIER_HANDLE_SIZE) { && event->pos().y() < post_point.y()+kBezierHandleSize) {
current_handle = BEZIER_HANDLE_POST; current_handle = kBezierHandlePost;
} }
if (current_handle != BEZIER_HANDLE_NONE) { if (current_handle != kBezierHandleNone) {
sel_key = j; sel_key = j;
sel_key_field = i; sel_key_field = i;
handle_index = j; handle_index = j;
@@ -437,7 +436,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
if (sel_key > -1) { if (sel_key > -1) {
for (int i=0;i<selected_keys.size();i++) { for (int i=0;i<selected_keys.size();i++) {
if (selected_keys.at(i) == sel_key && selected_keys_fields.at(i) == sel_key_field) { if (selected_keys.at(i) == sel_key && selected_keys_fields.at(i) == sel_key_field) {
if ((event->modifiers() & Qt::ShiftModifier) && current_handle == BEZIER_HANDLE_NONE) { if ((event->modifiers() & Qt::ShiftModifier) && current_handle == kBezierHandleNone) {
selected_keys.removeAt(i); selected_keys.removeAt(i);
selected_keys_fields.removeAt(i); selected_keys_fields.removeAt(i);
} }
@@ -513,7 +512,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
update(); update();
} else { } else {
switch (current_handle) { switch (current_handle) {
case BEZIER_HANDLE_NONE: case kBezierHandleNone:
for (int i=0;i<selected_keys.size();i++) { for (int i=0;i<selected_keys.size();i++) {
row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].time = qRound(selected_keys_old_vals.at(i) + (double(event->pos().x() - start_x)/x_zoom)); row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)].time = qRound(selected_keys_old_vals.at(i) + (double(event->pos().x() - start_x)/x_zoom));
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
@@ -525,8 +524,8 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
moved_keys = true; moved_keys = true;
update_ui(false); update_ui(false);
break; break;
case BEZIER_HANDLE_PRE: case kBezierHandlePre:
case BEZIER_HANDLE_POST: case kBezierHandlePost:
{ {
double new_pre_handle_x = old_pre_handle_x; double new_pre_handle_x = old_pre_handle_x;
double new_pre_handle_y = old_pre_handle_y; double new_pre_handle_y = old_pre_handle_y;
@@ -536,7 +535,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
double x_diff = double(event->pos().x() - start_x)/x_zoom; double x_diff = double(event->pos().x() - start_x)/x_zoom;
double y_diff = double(start_y - event->pos().y())/y_zoom; double y_diff = double(start_y - event->pos().y())/y_zoom;
if (current_handle == BEZIER_HANDLE_PRE) { if (current_handle == kBezierHandlePre) {
new_pre_handle_x += x_diff; new_pre_handle_x += x_diff;
if (!(event->modifiers() & Qt::ShiftModifier)) new_pre_handle_y += y_diff; if (!(event->modifiers() & Qt::ShiftModifier)) new_pre_handle_y += y_diff;
if (!(event->modifiers() & Qt::ControlModifier)) { if (!(event->modifiers() & Qt::ControlModifier)) {
@@ -582,16 +581,16 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
KEYFRAME_SIZE+KEYFRAME_SIZE KEYFRAME_SIZE+KEYFRAME_SIZE
); );
QRect pre_rect( QRect pre_rect(
qRound(key_x + key.pre_handle_x*x_zoom - BEZIER_HANDLE_SIZE), qRound(key_x + key.pre_handle_x*x_zoom - kBezierHandleSize),
qRound(key_y + key.pre_handle_y*y_zoom - BEZIER_HANDLE_SIZE), qRound(key_y + key.pre_handle_y*y_zoom - kBezierHandleSize),
BEZIER_HANDLE_SIZE+BEZIER_HANDLE_SIZE, kBezierHandleSize+kBezierHandleSize,
BEZIER_HANDLE_SIZE+BEZIER_HANDLE_SIZE kBezierHandleSize+kBezierHandleSize
); );
QRect post_rect( QRect post_rect(
qRound(key_x + key.post_handle_x*x_zoom - BEZIER_HANDLE_SIZE), qRound(key_x + key.post_handle_x*x_zoom - kBezierHandleSize),
qRound(key_y + key.post_handle_y*y_zoom - BEZIER_HANDLE_SIZE), qRound(key_y + key.post_handle_y*y_zoom - kBezierHandleSize),
BEZIER_HANDLE_SIZE+BEZIER_HANDLE_SIZE, kBezierHandleSize+kBezierHandleSize,
BEZIER_HANDLE_SIZE+BEZIER_HANDLE_SIZE kBezierHandleSize+kBezierHandleSize
); );
if (test_rect.contains(event->pos()) if (test_rect.contains(event->pos())
@@ -611,16 +610,16 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
if (event->pos().x() <= get_screen_x(f->keyframes.at(sorted_keys.first()).time)) { if (event->pos().x() <= get_screen_x(f->keyframes.at(sorted_keys.first()).time)) {
int y_comp = get_screen_y(f->keyframes.at(sorted_keys.first()).data.toDouble()); int y_comp = get_screen_y(f->keyframes.at(sorted_keys.first()).data.toDouble());
if (event->pos().y() >= y_comp-BEZIER_LINE_SIZE if (event->pos().y() >= y_comp-kBezierLineSize
&& event->pos().y() <= y_comp+BEZIER_LINE_SIZE) { && event->pos().y() <= y_comp+kBezierLineSize) {
// dout << "make an EARLY key on field" << i; // dout << "make an EARLY key on field" << i;
click_add = true; click_add = true;
click_add_type = f->keyframes.at(sorted_keys.first()).type; click_add_type = f->keyframes.at(sorted_keys.first()).type;
} }
} else if (event->pos().x() >= get_screen_x(f->keyframes.at(sorted_keys.last()).time)) { } else if (event->pos().x() >= get_screen_x(f->keyframes.at(sorted_keys.last()).time)) {
int y_comp = get_screen_y(f->keyframes.at(sorted_keys.last()).data.toDouble()); int y_comp = get_screen_y(f->keyframes.at(sorted_keys.last()).data.toDouble());
if (event->pos().y() >= y_comp-BEZIER_LINE_SIZE if (event->pos().y() >= y_comp-kBezierLineSize
&& event->pos().y() <= y_comp+BEZIER_LINE_SIZE) { && event->pos().y() <= y_comp+kBezierLineSize) {
// dout << "make an LATE key on field" << i; // dout << "make an LATE key on field" << i;
click_add = true; click_add = true;
click_add_type = f->keyframes.at(sorted_keys.last()).type; click_add_type = f->keyframes.at(sorted_keys.last()).type;
@@ -639,12 +638,12 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
if (event->pos().x() >= last_key_x if (event->pos().x() >= last_key_x
&& event->pos().x() <= key_x) { && event->pos().x() <= key_x) {
QRect mouse_rect(event->pos().x()-BEZIER_LINE_SIZE, event->pos().y()-BEZIER_LINE_SIZE, BEZIER_LINE_SIZE+BEZIER_LINE_SIZE, BEZIER_LINE_SIZE+BEZIER_LINE_SIZE); QRect mouse_rect(event->pos().x()-kBezierLineSize, event->pos().y()-kBezierLineSize, kBezierLineSize+kBezierLineSize, kBezierLineSize+kBezierLineSize);
// NOTE: FILTHY copy/paste from paintEvent // NOTE: FILTHY copy/paste from paintEvent
if (last_key.type == EFFECT_KEYFRAME_HOLD) { if (last_key.type == EFFECT_KEYFRAME_HOLD) {
// hold // hold
if (event->pos().y() >= last_key_y-BEZIER_LINE_SIZE if (event->pos().y() >= last_key_y-kBezierLineSize
&& event->pos().y() <= last_key_y+BEZIER_LINE_SIZE) { && event->pos().y() <= last_key_y+kBezierLineSize) {
// dout << "make an HOLD key on field" << i << "after key" << j; // dout << "make an HOLD key on field" << i << "after key" << j;
click_add = true; click_add = true;
} }
@@ -705,15 +704,15 @@ void GraphView::mouseReleaseEvent(QMouseEvent *) {
} else if (moved_keys && selected_keys.size() > 0) { } else if (moved_keys && selected_keys.size() > 0) {
ComboAction* ca = new ComboAction(); ComboAction* ca = new ComboAction();
switch (current_handle) { switch (current_handle) {
case BEZIER_HANDLE_NONE: case kBezierHandleNone:
for (int i=0;i<selected_keys.size();i++) { for (int i=0;i<selected_keys.size();i++) {
EffectKeyframe& key = row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)]; EffectKeyframe& key = row->field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)];
ca->append(new SetLong(&key.time, selected_keys_old_vals.at(i), key.time)); ca->append(new SetLong(&key.time, selected_keys_old_vals.at(i), key.time));
ca->append(new SetQVariant(&key.data, selected_keys_old_doubles.at(i), key.data)); ca->append(new SetQVariant(&key.data, selected_keys_old_doubles.at(i), key.data));
} }
break; break;
case BEZIER_HANDLE_PRE: case kBezierHandlePre:
case BEZIER_HANDLE_POST: case kBezierHandlePost:
{ {
EffectKeyframe& key = row->field(handle_field)->keyframes[handle_index]; EffectKeyframe& key = row->field(handle_field)->keyframes[handle_index];
ca->append(new SetDouble(&key.pre_handle_x, old_pre_handle_x, key.pre_handle_x)); ca->append(new SetDouble(&key.pre_handle_x, old_pre_handle_x, key.pre_handle_x));
@@ -756,7 +755,7 @@ void GraphView::wheelEvent(QWheelEvent *event) {
int x_delta = (event->modifiers() & Qt::ControlModifier) ? event->angleDelta().x() : y_delta; int x_delta = (event->modifiers() & Qt::ControlModifier) ? event->angleDelta().x() : y_delta;
if (y_delta != 0) { if (y_delta != 0) {
double zoom_diff = (GRAPH_ZOOM_SPEED*y_zoom); double zoom_diff = (kGraphZoomSpeed*y_zoom);
new_y_zoom = (y_delta < 0) ? y_zoom - zoom_diff : y_zoom + zoom_diff; new_y_zoom = (y_delta < 0) ? y_zoom - zoom_diff : y_zoom + zoom_diff;
// center zoom on screen // center zoom on screen
@@ -766,7 +765,7 @@ void GraphView::wheelEvent(QWheelEvent *event) {
} }
if (x_delta != 0) { if (x_delta != 0) {
double zoom_diff = (GRAPH_ZOOM_SPEED*x_zoom); double zoom_diff = (kGraphZoomSpeed*x_zoom);
new_x_zoom = (x_delta < 0) ? x_zoom - zoom_diff : x_zoom + zoom_diff; new_x_zoom = (x_delta < 0) ? x_zoom - zoom_diff : x_zoom + zoom_diff;
set_scroll_x(qRound((double(x_scroll)/x_zoom*new_x_zoom) + double(event->pos().x())*new_x_zoom - double(event->pos().x())*x_zoom)); set_scroll_x(qRound((double(x_scroll)/x_zoom*new_x_zoom) + double(event->pos().x())*new_x_zoom - double(event->pos().x())*x_zoom));
+66 -66
View File
@@ -24,99 +24,99 @@
#include <QWidget> #include <QWidget>
#include <QVector> #include <QVector>
class EffectRow; #include "project/effectrow.h"
class EffectField; #include "project/effectfield.h"
QColor get_curve_color(int index, int length); QColor get_curve_color(int index, int length);
class GraphView : public QWidget { class GraphView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
GraphView(QWidget* parent = 0); GraphView(QWidget* parent = nullptr);
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void set_row(EffectRow* r); void set_row(EffectRow* r);
void set_selected_keyframe_type(int type); void set_selected_keyframe_type(int type);
void set_field_visibility(int field, bool b); void set_field_visibility(int field, bool b);
void delete_selected_keys(); void delete_selected_keys();
void select_all(); void select_all();
signals: signals:
void x_scroll_changed(int); void x_scroll_changed(int);
void y_scroll_changed(int); void y_scroll_changed(int);
void zoom_changed(double, double); void zoom_changed(double, double);
void selection_changed(bool, int); void selection_changed(bool, int);
private: private:
int x_scroll; int x_scroll;
int y_scroll; int y_scroll;
bool mousedown; bool mousedown;
int start_x; int start_x;
int start_y; int start_y;
double x_zoom; double x_zoom;
double y_zoom; double y_zoom;
void set_scroll_x(int s); void set_scroll_x(int s);
void set_scroll_y(int s); void set_scroll_y(int s);
void set_zoom(double xz, double yz); void set_zoom(double xz, double yz);
int get_screen_x(double); int get_screen_x(double);
int get_screen_y(double); int get_screen_y(double);
long get_value_x(int); long get_value_x(int);
double get_value_y(int); double get_value_y(int);
void selection_update(); void selection_update();
QVector<bool> field_visibility; QVector<bool> field_visibility;
QVector<int> selected_keys; QVector<int> selected_keys;
QVector<int> selected_keys_fields; QVector<int> selected_keys_fields;
QVector<long> selected_keys_old_vals; QVector<long> selected_keys_old_vals;
QVector<double> selected_keys_old_doubles; QVector<double> selected_keys_old_doubles;
double old_pre_handle_x; double old_pre_handle_x;
double old_pre_handle_y; double old_pre_handle_y;
double old_post_handle_x; double old_post_handle_x;
double old_post_handle_y; double old_post_handle_y;
int handle_field; int handle_field;
int handle_index; int handle_index;
bool moved_keys; bool moved_keys;
int current_handle; int current_handle;
void draw_lines(QPainter &p, bool vert); void draw_lines(QPainter &p, bool vert);
void draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos); void draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos);
EffectRow* row; EffectRow* row;
bool rect_select; bool rect_select;
int rect_select_x; int rect_select_x;
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 rect_select_offset; int rect_select_offset;
long visible_in; long visible_in;
bool click_add; bool click_add;
bool click_add_proc; bool click_add_proc;
EffectField* click_add_field; EffectField* click_add_field;
int click_add_key; int click_add_key;
int click_add_type; int click_add_type;
private slots: private slots:
void show_context_menu(const QPoint& pos); void show_context_menu(const QPoint& pos);
void reset_view(); void reset_view();
void set_view_to_selection(); void set_view_to_selection();
void set_view_to_all(); void set_view_to_all();
void set_view_to_rect(int x1, double y1, int x2, double y2); void set_view_to_rect(int x1, double y1, int x2, double y2);
}; };
#endif // GRAPHVIEW_H #endif // GRAPHVIEW_H
+14 -11
View File
@@ -21,16 +21,19 @@
#ifndef TIMELINETOOLS_H #ifndef TIMELINETOOLS_H
#define TIMELINETOOLS_H #define TIMELINETOOLS_H
#define TIMELINE_TOOL_POINTER 0 enum TimelineTool {
#define TIMELINE_TOOL_EDIT 1 TIMELINE_TOOL_POINTER,
#define TIMELINE_TOOL_RAZOR 2 TIMELINE_TOOL_EDIT,
#define TIMELINE_TOOL_RIPPLE 3 TIMELINE_TOOL_RAZOR,
#define TIMELINE_TOOL_ROLLING 4 TIMELINE_TOOL_RIPPLE,
#define TIMELINE_TOOL_SLIP 5 TIMELINE_TOOL_ROLLING,
#define TIMELINE_TOOL_SLIDE 6 TIMELINE_TOOL_SLIP,
#define TIMELINE_TOOL_HAND 7 TIMELINE_TOOL_SLIDE,
#define TIMELINE_TOOL_ZOOM 8 TIMELINE_TOOL_HAND,
#define TIMELINE_TOOL_MENU 9 TIMELINE_TOOL_ZOOM,
#define TIMELINE_TOOL_TRANSITION 10 TIMELINE_TOOL_MENU,
TIMELINE_TOOL_TRANSITION,
TIMELINE_TOOL_COUNT
};
#endif // TIMELINETOOLS_H #endif // TIMELINETOOLS_H