made pasting effects undoable
This commit is contained in:
@@ -76,7 +76,7 @@ void EffectControls::menu_select(QAction* q) {
|
|||||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ca->append(new AddEffectCommand(c, meta));
|
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -80,7 +80,7 @@ void update_effect_controls() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool same = (selected_clips.size() == panel_effect_controls->selected_clips.size());
|
bool same = (selected_clips.size() == panel_effect_controls->selected_clips.size());
|
||||||
if (same) {
|
if (same) {
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
if (selected_clips.at(i) != panel_effect_controls->selected_clips.at(i)) {
|
if (selected_clips.at(i) != panel_effect_controls->selected_clips.at(i)) {
|
||||||
@@ -97,9 +97,8 @@ void update_effect_controls() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update_ui(bool modified) {
|
void update_ui(bool modified) {
|
||||||
if (modified) {
|
if (modified) {
|
||||||
// panel_sequence_viewer->reset_all_audio();
|
update_effect_controls();
|
||||||
update_effect_controls();
|
|
||||||
}
|
}
|
||||||
panel_effect_controls->update_keyframes();
|
panel_effect_controls->update_keyframes();
|
||||||
panel_timeline->repaint_timeline();
|
panel_timeline->repaint_timeline();
|
||||||
|
|||||||
+10
-1
@@ -973,17 +973,26 @@ void Timeline::paste(bool insert) {
|
|||||||
panel_sequence_viewer->seek(paste_end);
|
panel_sequence_viewer->seek(paste_end);
|
||||||
}
|
}
|
||||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
||||||
|
ComboAction* ca = new ComboAction();
|
||||||
|
bool push = false;
|
||||||
for (int i=0;i<sequence->clips.size();i++) {
|
for (int i=0;i<sequence->clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(i);
|
Clip* c = sequence->clips.at(i);
|
||||||
if (c != NULL && is_clip_selected(c, true)) {
|
if (c != NULL && is_clip_selected(c, true)) {
|
||||||
for (int j=0;j<clipboard.size();j++) {
|
for (int j=0;j<clipboard.size();j++) {
|
||||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
||||||
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
||||||
c->effects.append(e->copy(c));
|
ca->append(new AddEffectCommand(c, e->copy(c), NULL));
|
||||||
|
push = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (push) {
|
||||||
|
ca->appendPost(new ReloadEffectsCommand());
|
||||||
|
undo_stack.push(ca);
|
||||||
|
} else {
|
||||||
|
delete ca;
|
||||||
|
}
|
||||||
update_ui(true);
|
update_ui(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-25
@@ -198,10 +198,10 @@ void SetTimelineInOutCommand::redo() {
|
|||||||
mainWindow->setWindowModified(true);
|
mainWindow->setWindowModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddEffectCommand::AddEffectCommand(Clip* c, const EffectMeta *e) :
|
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m) :
|
||||||
clip(c),
|
clip(c),
|
||||||
meta(e),
|
meta(m),
|
||||||
ref(NULL),
|
ref(e),
|
||||||
done(false),
|
done(false),
|
||||||
old_project_changed(mainWindow->isWindowModified())
|
old_project_changed(mainWindow->isWindowModified())
|
||||||
{}
|
{}
|
||||||
@@ -211,6 +211,7 @@ AddEffectCommand::~AddEffectCommand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddEffectCommand::undo() {
|
void AddEffectCommand::undo() {
|
||||||
|
clip->effects.last()->close();
|
||||||
clip->effects.removeLast();
|
clip->effects.removeLast();
|
||||||
done = false;
|
done = false;
|
||||||
mainWindow->setWindowModified(old_project_changed);
|
mainWindow->setWindowModified(old_project_changed);
|
||||||
@@ -703,7 +704,9 @@ void EffectDeleteCommand::redo() {
|
|||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
Clip* c = clips.at(i);
|
||||||
int fx_id = fx.at(i) - i;
|
int fx_id = fx.at(i) - i;
|
||||||
deleted_objects.append(c->effects.at(fx_id));
|
Effect* e = c->effects.at(fx_id);
|
||||||
|
e->close();
|
||||||
|
deleted_objects.append(e);
|
||||||
c->effects.removeAt(fx_id);
|
c->effects.removeAt(fx_id);
|
||||||
}
|
}
|
||||||
panel_effect_controls->reload_clips();
|
panel_effect_controls->reload_clips();
|
||||||
@@ -1300,26 +1303,10 @@ void SetPointer::redo() {
|
|||||||
mainWindow->setWindowModified(true);
|
mainWindow->setWindowModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*MoveGizmo::MoveGizmo(Effect *e, EffectGizmo *g, int x_movement, int y_movement, double tc) :
|
void ReloadEffectsCommand::undo() {
|
||||||
effect(e),
|
redo();
|
||||||
gizmo(g),
|
|
||||||
x(x_movement),
|
|
||||||
y(y_movement),
|
|
||||||
timecode(tc),
|
|
||||||
done(true),
|
|
||||||
old_changed(mainWindow->isWindowModified())
|
|
||||||
{}
|
|
||||||
|
|
||||||
void MoveGizmo::undo() {
|
|
||||||
effect->gizmo_move(gizmo, -x, -y, timecode);
|
|
||||||
mainWindow->setWindowModified(old_changed);
|
|
||||||
done = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveGizmo::redo() {
|
void ReloadEffectsCommand::redo() {
|
||||||
if (!done) {
|
panel_effect_controls->reload_clips();
|
||||||
effect->gizmo_move(gizmo, x, y, timecode);
|
}
|
||||||
mainWindow->setWindowModified(true);
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|||||||
+3
-12
@@ -88,7 +88,7 @@ private:
|
|||||||
|
|
||||||
class AddEffectCommand : public QUndoCommand {
|
class AddEffectCommand : public QUndoCommand {
|
||||||
public:
|
public:
|
||||||
AddEffectCommand(Clip* c, const EffectMeta* e);
|
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m);
|
||||||
~AddEffectCommand();
|
~AddEffectCommand();
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
@@ -598,19 +598,10 @@ private:
|
|||||||
void* old_data;
|
void* old_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*class MoveGizmo : public QUndoCommand {
|
class ReloadEffectsCommand : public QUndoCommand {
|
||||||
public:
|
public:
|
||||||
MoveGizmo(Effect* e, EffectGizmo* g, int x_movement, int y_movement, double tc);
|
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
private:
|
};
|
||||||
Effect* effect;
|
|
||||||
EffectGizmo* gizmo;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
double timecode;
|
|
||||||
bool done;
|
|
||||||
bool old_changed;
|
|
||||||
};*/
|
|
||||||
|
|
||||||
#endif // UNDO_H
|
#endif // UNDO_H
|
||||||
|
|||||||
Reference in New Issue
Block a user