workarea in/out added #108

This commit is contained in:
itsmattkc
2018-07-22 19:57:03 +01:00
parent 6109ed9002
commit 1fded74767
18 changed files with 335 additions and 55 deletions
+13 -4
View File
@@ -406,9 +406,9 @@ void Project::clear() {
void Project::new_project() {
// clear existing project
set_sequence(NULL);
clear();
project_changed = false;
set_sequence(NULL);
}
QTreeWidgetItem* Project::find_loaded_folder_by_id(int id) {
@@ -579,6 +579,11 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
s->audio_layout = attr.value().toInt();
} else if (attr.name() == "open") {
open_sequence = true;
} else if (attr.name() == "workareaIn") {
s->using_workarea = true;
s->workarea_in = attr.value().toLong();
} else if (attr.name() == "workareaOut") {
s->workarea_out = attr.value().toLong();
}
}
@@ -596,11 +601,11 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
} else if (attr.name() == "id") {
c->load_id = attr.value().toInt();
} else if (attr.name() == "clipin") {
c->clip_in = attr.value().toInt();
c->clip_in = attr.value().toLong();
} else if (attr.name() == "in") {
c->timeline_in = attr.value().toInt();
c->timeline_in = attr.value().toLong();
} else if (attr.name() == "out") {
c->timeline_out = attr.value().toInt();
c->timeline_out = attr.value().toLong();
} else if (attr.name() == "track") {
c->track = attr.value().toInt();
} else if (attr.name() == "r") {
@@ -842,6 +847,10 @@ void Project::save_folder(QXmlStreamWriter& stream, QTreeWidgetItem* parent, int
if (s == sequence) {
stream.writeAttribute("open", "1");
}
if (s->using_workarea) {
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
}
for (int j=0;j<s->clip_count();j++) {
Clip* c = s->get_clip(j);
if (c != NULL) {
+1 -1
View File
@@ -15,7 +15,7 @@ class QXmlStreamWriter;
class QXmlStreamReader;
class QFile;
#define SAVE_VERSION "180719"
#define SAVE_VERSION "180722"
#define MEDIA_TYPE_FOOTAGE 0
#define MEDIA_TYPE_SEQUENCE 1
+32 -8
View File
@@ -35,7 +35,6 @@ Timeline::Timeline(QWidget *parent) :
edit_tool_selects_links(false),
edit_tool_also_seeks(false),
select_also_seeks(false),
using_workarea(false),
paste_seeks(true),
snapping(true),
last_frame(0),
@@ -206,6 +205,14 @@ int Timeline::calculate_track_height(int track, int value) {
return vector.at(index);
}
void Timeline::set_in_point() {
ui->headers->set_in_point(playhead);
}
void Timeline::set_out_point() {
ui->headers->set_out_point(playhead);
}
void Timeline::update_sequence() {
bool null_sequence = (sequence == NULL);
@@ -216,16 +223,14 @@ void Timeline::update_sequence() {
ui->pushButton_4->setEnabled(!null_sequence);
ui->pushButton_5->setEnabled(!null_sequence);
ui->headers->setEnabled(!null_sequence);
// ui->video_area->setEnabled(!null_sequence);
// ui->audio_area->setEnabled(!null_sequence);
if (null_sequence) {
setWindowTitle("Timeline: <none>");
} else {
setWindowTitle("Timeline: " + sequence->name);
reset_all_audio();
redraw_all_clips(false);
playback_updater.setInterval(qFloor(1000 / sequence->frame_rate));
reset_all_audio();
}
}
@@ -279,6 +284,27 @@ void Timeline::select_all() {
repaint_timeline();
}
void Timeline::delete_in_out(bool ripple) {
if (sequence != NULL && sequence->using_workarea) {
QVector<Selection> areas;
int video_tracks = 0, audio_tracks = 0;
sequence->get_track_limits(&video_tracks, &audio_tracks);
for (int i=video_tracks;i<=audio_tracks;i++) {
Selection s;
s.in = sequence->workarea_in;
s.out = sequence->workarea_out;
s.track = i;
areas.append(s);
}
TimelineAction* ta = new TimelineAction();
panel_timeline->delete_areas_and_relink(ta, areas);
if (ripple) ta->ripple(sequence, sequence->workarea_in, sequence->workarea_in - sequence->workarea_out);
ta->set_in_out(sequence, false, 0, 0);
undo_stack.push(ta);
redraw_all_clips(true);
}
}
void Timeline::delete_selection(bool ripple_delete) {
if (selections.size() > 0) {
panel_effect_controls->clear_effects(true);
@@ -301,7 +327,6 @@ void Timeline::delete_selection(bool ripple_delete) {
// it feels a little more intuitive with this here
ripple_point++;
QVector<int> ignore;
bool can_ripple = true;
for (int i=0;i<sequence->clip_count();i++) {
Clip* c = sequence->get_clip(i);
@@ -329,7 +354,7 @@ void Timeline::delete_selection(bool ripple_delete) {
}
}
}
if (can_ripple) ta->ripple(sequence, ripple_point, -ripple_length, ignore);
if (can_ripple) ta->ripple(sequence, ripple_point, -ripple_length);
}
selections.clear();
@@ -743,10 +768,9 @@ void Timeline::ripple_to_in_point(bool in) {
}
// trim and move clips around the in point
QVector<int> ignore;
TimelineAction* ta = new TimelineAction();
delete_areas_and_relink(ta, areas);
ta->ripple(sequence, in_point, (in) ? (in_point - playhead) : (playhead - in_point), ignore);
ta->ripple(sequence, in_point, (in) ? (in_point - playhead) : (playhead - in_point));
undo_stack.push(ta);
redraw_all_clips(true);
+4 -5
View File
@@ -85,6 +85,9 @@ public:
bool has_clip_been_split(int c);
void toggle_links();
void ripple_to_in_point(bool in);
void set_in_point();
void set_out_point();
void delete_in_out(bool ripple);
int get_snap_range();
int getScreenPointFromFrame(long frame);
@@ -93,11 +96,7 @@ public:
bool snap_to_point(long point, long* l);
void snap_to_clip(long* l, bool playhead_inclusive);
long playhead;
bool using_workarea;
long workarea_in;
long workarea_out;
long playhead;
// playback functions
void go_to_start();