undos now save the modified flag state
This commit is contained in:
@@ -114,16 +114,3 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ValueChangeCommand::ValueChangeCommand() : done(true) {}
|
||||
|
||||
void ValueChangeCommand::undo() {
|
||||
source->set_value(old_val);
|
||||
done = false;
|
||||
}
|
||||
|
||||
void ValueChangeCommand::redo() {
|
||||
if (!done) {
|
||||
source->set_value(new_val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,16 +39,4 @@ signals:
|
||||
void valueChanged();
|
||||
};
|
||||
|
||||
class ValueChangeCommand : public QUndoCommand {
|
||||
public:
|
||||
ValueChangeCommand();
|
||||
LabelSlider* source;
|
||||
float old_val;
|
||||
float new_val;
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
bool done;
|
||||
};
|
||||
|
||||
#endif // LABELSLIDER_H
|
||||
|
||||
@@ -204,55 +204,7 @@ void SourceTable::dropEvent(QDropEvent* event) {
|
||||
mm->to = drop_item;
|
||||
mm->items = move_items;
|
||||
undo_stack.push(mm);
|
||||
project_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MediaMove::MediaMove(SourceTable *s) : table(s) {}
|
||||
|
||||
void MediaMove::undo() {
|
||||
for (int i=0;i<items.size();i++) {
|
||||
if (to == NULL) {
|
||||
table->takeTopLevelItem(table->indexOfTopLevelItem(items.at(i)));
|
||||
} else {
|
||||
to->removeChild(items.at(i));
|
||||
}
|
||||
if (froms.at(i) == NULL) {
|
||||
table->addTopLevelItem(items.at(i));
|
||||
} else {
|
||||
froms.at(i)->addChild(items.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MediaMove::redo() {
|
||||
for (int i=0;i<items.size();i++) {
|
||||
QTreeWidgetItem* parent = items.at(i)->parent();
|
||||
froms.append(parent);
|
||||
if (parent == NULL) {
|
||||
table->takeTopLevelItem(table->indexOfTopLevelItem(items.at(i)));
|
||||
} else {
|
||||
parent->removeChild(items.at(i));
|
||||
}
|
||||
if (to == NULL) {
|
||||
table->addTopLevelItem(items.at(i));
|
||||
} else {
|
||||
to->addChild(items.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MediaRename::MediaRename() : done(true) {}
|
||||
|
||||
void MediaRename::undo() {
|
||||
item->setText(0, from);
|
||||
done = false;
|
||||
}
|
||||
|
||||
void MediaRename::redo() {
|
||||
if (!done) {
|
||||
item->setText(0, to);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,28 +30,4 @@ private slots:
|
||||
void show_context_menu(const QPoint& pos);
|
||||
};
|
||||
|
||||
class MediaMove : public QUndoCommand {
|
||||
public:
|
||||
MediaMove(SourceTable* s);
|
||||
QVector<QTreeWidgetItem*> items;
|
||||
QTreeWidgetItem* to;
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
QVector<QTreeWidgetItem*> froms;
|
||||
SourceTable* table;
|
||||
};
|
||||
|
||||
class MediaRename : public QUndoCommand {
|
||||
public:
|
||||
MediaRename();
|
||||
QTreeWidgetItem* item;
|
||||
QString from;
|
||||
QString to;
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
bool done;
|
||||
};
|
||||
|
||||
#endif // SOURCETABLE_H
|
||||
|
||||
+19
-15
@@ -524,7 +524,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
ta->ripple(sequence, ripple_point, ripple_length, ignore_clips);
|
||||
}
|
||||
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER && (event->modifiers() & Qt::AltModifier)) { // if holding alt, duplicate rather than move
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER
|
||||
&& (event->modifiers() & Qt::AltModifier)
|
||||
&& panel_timeline->trim_target == -1) { // if holding alt (and not trimming), duplicate rather than move
|
||||
// duplicate clips
|
||||
QVector<int> old_clips;
|
||||
QVector<Clip*> new_clips;
|
||||
@@ -808,6 +810,11 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
if (validator > g.media_length) frame_diff += validator - g.media_length;
|
||||
}
|
||||
} else if (g.trimming) {
|
||||
MediaStream* ms = NULL;
|
||||
if (c->media_type == MEDIA_TYPE_FOOTAGE) {
|
||||
ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream);
|
||||
}
|
||||
|
||||
if (g.trim_in) {
|
||||
// prevent clip/transition length from being less than 1 frame long
|
||||
validator = g.ghost_length - frame_diff;
|
||||
@@ -819,26 +826,23 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
|
||||
if (g.transition == NULL || g.transition == c->opening_transition) {
|
||||
// prevent clip_in from going below 0
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (c->media_type == MEDIA_TYPE_FOOTAGE && !static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream)->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
// prevent clip_in from going below 0
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
} else {
|
||||
// prevent clip length from being less than 1 frame long
|
||||
validator = g.ghost_length + frame_diff;
|
||||
if (validator < 1) frame_diff += (1 - validator);
|
||||
|
||||
if (g.transition == NULL) {
|
||||
// prevent clip length exceeding media length
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (c->media_type == MEDIA_TYPE_FOOTAGE && !static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream)->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
// prevent clip length exceeding media length
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
qDebug() << i << validator;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user