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));
|
||||
}
|
||||
} 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) {
|
||||
for (int i=0;i<selected_clips.size();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) {
|
||||
if (modified) {
|
||||
// panel_sequence_viewer->reset_all_audio();
|
||||
update_effect_controls();
|
||||
if (modified) {
|
||||
update_effect_controls();
|
||||
}
|
||||
panel_effect_controls->update_keyframes();
|
||||
panel_timeline->repaint_timeline();
|
||||
|
||||
+10
-1
@@ -973,17 +973,26 @@ void Timeline::paste(bool insert) {
|
||||
panel_sequence_viewer->seek(paste_end);
|
||||
}
|
||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool push = false;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
for (int j=0;j<clipboard.size();j++) {
|
||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-25
@@ -198,10 +198,10 @@ void SetTimelineInOutCommand::redo() {
|
||||
mainWindow->setWindowModified(true);
|
||||
}
|
||||
|
||||
AddEffectCommand::AddEffectCommand(Clip* c, const EffectMeta *e) :
|
||||
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m) :
|
||||
clip(c),
|
||||
meta(e),
|
||||
ref(NULL),
|
||||
meta(m),
|
||||
ref(e),
|
||||
done(false),
|
||||
old_project_changed(mainWindow->isWindowModified())
|
||||
{}
|
||||
@@ -211,6 +211,7 @@ AddEffectCommand::~AddEffectCommand() {
|
||||
}
|
||||
|
||||
void AddEffectCommand::undo() {
|
||||
clip->effects.last()->close();
|
||||
clip->effects.removeLast();
|
||||
done = false;
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
@@ -703,7 +704,9 @@ void EffectDeleteCommand::redo() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(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);
|
||||
}
|
||||
panel_effect_controls->reload_clips();
|
||||
@@ -1300,26 +1303,10 @@ void SetPointer::redo() {
|
||||
mainWindow->setWindowModified(true);
|
||||
}
|
||||
|
||||
/*MoveGizmo::MoveGizmo(Effect *e, EffectGizmo *g, int x_movement, int y_movement, double tc) :
|
||||
effect(e),
|
||||
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 ReloadEffectsCommand::undo() {
|
||||
redo();
|
||||
}
|
||||
|
||||
void MoveGizmo::redo() {
|
||||
if (!done) {
|
||||
effect->gizmo_move(gizmo, x, y, timecode);
|
||||
mainWindow->setWindowModified(true);
|
||||
done = true;
|
||||
}
|
||||
}*/
|
||||
void ReloadEffectsCommand::redo() {
|
||||
panel_effect_controls->reload_clips();
|
||||
}
|
||||
|
||||
+3
-12
@@ -88,7 +88,7 @@ private:
|
||||
|
||||
class AddEffectCommand : public QUndoCommand {
|
||||
public:
|
||||
AddEffectCommand(Clip* c, const EffectMeta* e);
|
||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m);
|
||||
~AddEffectCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
@@ -598,19 +598,10 @@ private:
|
||||
void* old_data;
|
||||
};
|
||||
|
||||
/*class MoveGizmo : public QUndoCommand {
|
||||
class ReloadEffectsCommand : public QUndoCommand {
|
||||
public:
|
||||
MoveGizmo(Effect* e, EffectGizmo* g, int x_movement, int y_movement, double tc);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Effect* effect;
|
||||
EffectGizmo* gizmo;
|
||||
int x;
|
||||
int y;
|
||||
double timecode;
|
||||
bool done;
|
||||
bool old_changed;
|
||||
};*/
|
||||
};
|
||||
|
||||
#endif // UNDO_H
|
||||
|
||||
Reference in New Issue
Block a user