added paste insert
This commit is contained in:
+7
-1
@@ -393,7 +393,7 @@ void MainWindow::copy() {
|
||||
|
||||
void MainWindow::paste() {
|
||||
if (panel_timeline->focused() && sequence != NULL) {
|
||||
panel_timeline->paste();
|
||||
panel_timeline->paste(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -985,3 +985,9 @@ void MainWindow::on_actionEnable_Drop_on_Media_to_Replace_triggered() {
|
||||
void MainWindow::on_actionFootage_Viewer_triggered() {
|
||||
panel_footage_viewer->setVisible(!panel_footage_viewer->isVisible());
|
||||
}
|
||||
|
||||
void MainWindow::on_actionPasteInsert_triggered() {
|
||||
if (panel_timeline->focused() && sequence != NULL) {
|
||||
panel_timeline->paste(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ private slots:
|
||||
|
||||
void on_actionFootage_Viewer_triggered();
|
||||
|
||||
void on_actionPasteInsert_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
void setup_layout(bool reset);
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<addaction name="actionCu_t"/>
|
||||
<addaction name="actionCop_y"/>
|
||||
<addaction name="action_Paste"/>
|
||||
<addaction name="actionPasteInsert"/>
|
||||
<addaction name="actionDuplicate"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="actionRipple_Delete"/>
|
||||
@@ -288,6 +289,14 @@
|
||||
<string>Ctrl+V</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPasteInsert">
|
||||
<property name="text">
|
||||
<string>Paste Insert</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+V</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
|
||||
+37
-21
@@ -842,14 +842,15 @@ void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& n
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::paste() {
|
||||
void Timeline::paste(bool insert) {
|
||||
if (clip_clipboard.size() > 0) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
// create copies and delete areas that we'll be pasting to
|
||||
QVector<Selection> delete_areas;
|
||||
QVector<Clip*> pasted_clips;
|
||||
long paste_end = 0;
|
||||
long paste_start = LONG_MAX;
|
||||
long paste_end = LONG_MIN;
|
||||
for (int i=0;i<clip_clipboard.size();i++) {
|
||||
Clip* c = clip_clipboard.at(i);
|
||||
|
||||
@@ -858,19 +859,29 @@ void Timeline::paste() {
|
||||
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;
|
||||
|
||||
paste_start = qMin(paste_start, cc->timeline_in);
|
||||
paste_end = qMax(paste_end, cc->timeline_out);
|
||||
|
||||
pasted_clips.append(cc);
|
||||
|
||||
Selection s;
|
||||
s.in = cc->timeline_in;
|
||||
s.out = cc->timeline_out;
|
||||
s.track = c->track;
|
||||
delete_areas.append(s);
|
||||
if (!insert) {
|
||||
Selection s;
|
||||
s.in = cc->timeline_in;
|
||||
s.out = cc->timeline_out;
|
||||
s.track = c->track;
|
||||
delete_areas.append(s);
|
||||
}
|
||||
}
|
||||
if (insert) {
|
||||
split_cache.clear();
|
||||
split_all_clips_at_point(ca, sequence->playhead);
|
||||
ca->append(new RippleCommand(sequence, paste_start, paste_end - paste_start));
|
||||
} else {
|
||||
delete_areas_and_relink(ca, delete_areas);
|
||||
}
|
||||
delete_areas_and_relink(ca, delete_areas);
|
||||
|
||||
// ADAPT
|
||||
// correct linked clips
|
||||
for (int i=0;i<clip_clipboard.size();i++) {
|
||||
// these indices should correspond
|
||||
Clip* oc = clip_clipboard.at(i);
|
||||
@@ -883,7 +894,6 @@ void Timeline::paste() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ADAPT
|
||||
|
||||
ca->append(new AddClipCommand(sequence, pasted_clips));
|
||||
|
||||
@@ -1056,6 +1066,20 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
||||
bool split = false;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, point, true)) {
|
||||
split = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return split;
|
||||
}
|
||||
|
||||
void Timeline::split_at_playhead() {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool split_selected = false;
|
||||
@@ -1089,15 +1113,7 @@ void Timeline::split_at_playhead() {
|
||||
|
||||
// if nothing was selected or no selections fell within playhead, simply split at playhead
|
||||
if (!split_selected) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, sequence->playhead, true)) {
|
||||
split_selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
split_selected = split_all_clips_at_point(ca, sequence->playhead);
|
||||
}
|
||||
|
||||
if (split_selected) {
|
||||
|
||||
+2
-1
@@ -74,12 +74,13 @@ public:
|
||||
bool focused();
|
||||
void set_zoom(bool in);
|
||||
void copy(bool del);
|
||||
void paste();
|
||||
void paste(bool insert);
|
||||
void deselect();
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame);
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
void split_at_playhead();
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
void deselect_area(long in, long out, int track);
|
||||
|
||||
@@ -398,10 +398,13 @@ void insert_clips(ComboAction* ca) {
|
||||
if (g.clip >= 0) {
|
||||
ignore_clips.append(sequence->clips.at(g.clip));
|
||||
} else {
|
||||
// don't try to close old gap if importing
|
||||
ripple_old_point = false;
|
||||
}
|
||||
}
|
||||
|
||||
panel_timeline->split_cache.clear();
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
@@ -417,6 +420,8 @@ void insert_clips(ComboAction* ca) {
|
||||
if (c->timeline_in < earliest_new_point && c->timeline_out > earliest_new_point) {
|
||||
panel_timeline->split_clip_and_relink(ca, i, earliest_new_point, true);
|
||||
}
|
||||
|
||||
// determine if we should close the gap the old clips left behind
|
||||
if (ripple_old_point
|
||||
&& !((c->timeline_in < earliest_old_point && c->timeline_out <= earliest_old_point) || (c->timeline_in >= latest_old_point && c->timeline_out > latest_old_point))
|
||||
&& !ignore_clips.contains(c)) {
|
||||
@@ -426,8 +431,6 @@ void insert_clips(ComboAction* ca) {
|
||||
}
|
||||
}
|
||||
|
||||
panel_timeline->split_cache.clear();
|
||||
|
||||
long ripple_length = (latest_new_point - earliest_new_point);
|
||||
|
||||
RippleCommand* rc = new RippleCommand(sequence, earliest_new_point, ripple_length);
|
||||
|
||||
Reference in New Issue
Block a user