move undo files around for better organization

This commit is contained in:
itsmattkc
2023-02-20 16:09:22 -08:00
parent c5da1339b9
commit 11e4e051c3
76 changed files with 1612 additions and 1742 deletions
-2
View File
@@ -36,8 +36,6 @@ set(OLIVE_SOURCES
widget/nodeparamview/nodeparamviewkeyframecontrol.h
widget/nodeparamview/nodeparamviewtextedit.cpp
widget/nodeparamview/nodeparamviewtextedit.h
widget/nodeparamview/nodeparamviewundo.cpp
widget/nodeparamview/nodeparamviewundo.h
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
widget/nodeparamview/nodeparamviewwidgetbridge.h
PARENT_SCOPE
+1 -2
View File
@@ -26,9 +26,8 @@
#include <QScrollBar>
#include <QSplitter>
#include "node/nodeundo.h"
#include "node/output/viewer/viewer.h"
#include "widget/nodeparamview/nodeparamviewundo.h"
#include "widget/nodeview/nodeviewundo.h"
#include "widget/timeruler/timeruler.h"
namespace olive {
@@ -25,9 +25,9 @@
#include "common/qtutils.h"
#include "core.h"
#include "node/node.h"
#include "node/nodeundo.h"
#include "widget/collapsebutton/collapsebutton.h"
#include "widget/menu/menu.h"
#include "widget/nodeview/nodeviewundo.h"
namespace olive {
@@ -24,7 +24,7 @@
#include "node/block/clip/clip.h"
#include "node/factory.h"
#include "widget/nodeview/nodeviewundo.h"
#include "node/nodeundo.h"
namespace olive {
@@ -27,8 +27,8 @@
#include "core.h"
#include "dialog/speedduration/speeddurationdialog.h"
#include "node/group/group.h"
#include "node/nodeundo.h"
#include "node/project/sequence/sequence.h"
#include "nodeparamviewundo.h"
namespace olive {
@@ -444,7 +444,7 @@ void NodeParamViewItemBody::ArrayAppendClicked()
for (auto it=array_ui_.cbegin(); it!=array_ui_.cend(); it++) {
if (it.value().append_btn == sender()) {
NodeInput real_input = NodeGroup::ResolveInput(NodeInput(it.key().node, it.key().input));
Core::instance()->undo_stack()->push(new Node::ArrayInsertCommand(real_input.node(), real_input.input(), real_input.GetArraySize()+1));
Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(real_input.node(), real_input.input(), real_input.GetArraySize()+1));
break;
}
}
@@ -456,7 +456,7 @@ void NodeParamViewItemBody::ArrayInsertClicked()
if (it.value().array_insert_btn == sender()) {
// Found our input and element
NodeInput ic = NodeGroup::ResolveInput(it.key());
Core::instance()->undo_stack()->push(new Node::ArrayInsertCommand(ic.node(), ic.input(), ic.element()));
Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(ic.node(), ic.input(), ic.element()));
break;
}
}
@@ -468,7 +468,7 @@ void NodeParamViewItemBody::ArrayRemoveClicked()
if (it.value().array_remove_btn == sender()) {
// Found our input and element
NodeInput ic = NodeGroup::ResolveInput(it.key());
Core::instance()->undo_stack()->push(new Node::ArrayRemoveCommand(ic.node(), ic.input(), ic.element()));
Core::instance()->undo_stack()->push(new NodeArrayRemoveCommand(ic.node(), ic.input(), ic.element()));
break;
}
}
@@ -24,7 +24,7 @@
#include <QMessageBox>
#include "core.h"
#include "nodeparamviewundo.h"
#include "node/nodeundo.h"
#include "ui/icons/icons.h"
namespace olive {
@@ -1,215 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "nodeparamviewundo.h"
#include "node/node.h"
#include "node/project/sequence/sequence.h"
namespace olive {
NodeParamSetKeyframingCommand::NodeParamSetKeyframingCommand(const NodeInput &input, bool setting) :
input_(input),
new_setting_(setting)
{
}
Project *NodeParamSetKeyframingCommand::GetRelevantProject() const
{
return input_.node()->project();
}
void NodeParamSetKeyframingCommand::redo()
{
old_setting_ = input_.IsKeyframing();
input_.node()->SetInputIsKeyframing(input_, new_setting_);
}
void NodeParamSetKeyframingCommand::undo()
{
input_.node()->SetInputIsKeyframing(input_, old_setting_);
}
NodeParamSetKeyframeValueCommand::NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& value) :
key_(key),
old_value_(key_->value()),
new_value_(value)
{
}
NodeParamSetKeyframeValueCommand::NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant &new_value, const QVariant &old_value) :
key_(key),
old_value_(old_value),
new_value_(new_value)
{
}
Project *NodeParamSetKeyframeValueCommand::GetRelevantProject() const
{
return key_->parent()->project();
}
void NodeParamSetKeyframeValueCommand::redo()
{
key_->set_value(new_value_);
}
void NodeParamSetKeyframeValueCommand::undo()
{
key_->set_value(old_value_);
}
NodeParamInsertKeyframeCommand::NodeParamInsertKeyframeCommand(Node* node, NodeKeyframe* keyframe) :
input_(node),
keyframe_(keyframe)
{
// Take ownership of the keyframe
undo();
}
Project *NodeParamInsertKeyframeCommand::GetRelevantProject() const
{
return input_->project();
}
void NodeParamInsertKeyframeCommand::redo()
{
keyframe_->setParent(input_);
}
void NodeParamInsertKeyframeCommand::undo()
{
keyframe_->setParent(&memory_manager_);
}
NodeParamRemoveKeyframeCommand::NodeParamRemoveKeyframeCommand(NodeKeyframe* keyframe) :
input_(keyframe->parent()),
keyframe_(keyframe)
{
}
Project *NodeParamRemoveKeyframeCommand::GetRelevantProject() const
{
return input_->project();
}
void NodeParamRemoveKeyframeCommand::redo()
{
// Removes from input
keyframe_->setParent(&memory_manager_);
}
void NodeParamRemoveKeyframeCommand::undo()
{
keyframe_->setParent(input_);
}
NodeParamSetKeyframeTimeCommand::NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational &time) :
key_(key),
old_time_(key->time()),
new_time_(time)
{
}
NodeParamSetKeyframeTimeCommand::NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational &new_time, const rational &old_time) :
key_(key),
old_time_(old_time),
new_time_(new_time)
{
}
Project *NodeParamSetKeyframeTimeCommand::GetRelevantProject() const
{
return key_->parent()->project();
}
void NodeParamSetKeyframeTimeCommand::redo()
{
key_->set_time(new_time_);
}
void NodeParamSetKeyframeTimeCommand::undo()
{
key_->set_time(old_time_);
}
NodeParamSetStandardValueCommand::NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant &value) :
ref_(input),
old_value_(ref_.input().node()->GetStandardValue(ref_.input())),
new_value_(value)
{
}
NodeParamSetStandardValueCommand::NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant &new_value, const QVariant &old_value) :
ref_(input),
old_value_(old_value),
new_value_(new_value)
{
}
Project *NodeParamSetStandardValueCommand::GetRelevantProject() const
{
return ref_.input().node()->project();
}
void NodeParamSetStandardValueCommand::redo()
{
ref_.input().node()->SetSplitStandardValueOnTrack(ref_, new_value_);
}
void NodeParamSetStandardValueCommand::undo()
{
ref_.input().node()->SetSplitStandardValueOnTrack(ref_, old_value_);
}
NodeParamArrayAppendCommand::NodeParamArrayAppendCommand(Node *node, const QString &input) :
node_(node),
input_(input)
{
}
Project *NodeParamArrayAppendCommand::GetRelevantProject() const
{
return node_->project();
}
void NodeParamArrayAppendCommand::redo()
{
node_->InputArrayAppend(input_);
}
void NodeParamArrayAppendCommand::undo()
{
node_->InputArrayRemoveLast(input_);
}
void NodeSetValueHintCommand::redo()
{
old_hint_ = input_.node()->GetValueHintForInput(input_.input(), input_.element());
input_.node()->SetValueHintForInput(input_.input(), new_hint_, input_.element());
}
void NodeSetValueHintCommand::undo()
{
input_.node()->SetValueHintForInput(input_.input(), old_hint_, input_.element());
}
}
@@ -1,239 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef NODEPARAMVIEWUNDO_H
#define NODEPARAMVIEWUNDO_H
#include "node/keyframe.h"
#include "node/node.h"
#include "node/param.h"
#include "undo/undocommand.h"
namespace olive {
class NodeParamSetKeyframingCommand : public UndoCommand
{
public:
NodeParamSetKeyframingCommand(const NodeInput& input, bool setting);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
NodeInput input_;
bool new_setting_;
bool old_setting_;
};
class NodeParamInsertKeyframeCommand : public UndoCommand
{
public:
NodeParamInsertKeyframeCommand(Node *node, NodeKeyframe* keyframe);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
Node* input_;
NodeKeyframe* keyframe_;
QObject memory_manager_;
};
class NodeParamRemoveKeyframeCommand : public UndoCommand
{
public:
NodeParamRemoveKeyframeCommand(NodeKeyframe* keyframe);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
Node* input_;
NodeKeyframe* keyframe_;
QObject memory_manager_;
};
class NodeParamSetKeyframeTimeCommand : public UndoCommand
{
public:
NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational& time);
NodeParamSetKeyframeTimeCommand(NodeKeyframe* key, const rational& new_time, const rational& old_time);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
NodeKeyframe* key_;
rational old_time_;
rational new_time_;
};
class NodeParamSetKeyframeValueCommand : public UndoCommand
{
public:
NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& value);
NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& new_value, const QVariant& old_value);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
NodeKeyframe* key_;
QVariant old_value_;
QVariant new_value_;
};
class NodeParamSetStandardValueCommand : public UndoCommand
{
public:
NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant& value);
NodeParamSetStandardValueCommand(const NodeKeyframeTrackReference& input, const QVariant& new_value, const QVariant& old_value);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
NodeKeyframeTrackReference ref_;
QVariant old_value_;
QVariant new_value_;
};
class NodeParamSetSplitStandardValueCommand : public UndoCommand
{
public:
NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& new_value, const SplitValue& old_value) :
ref_(input),
old_value_(old_value),
new_value_(new_value)
{}
NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& value) :
NodeParamSetSplitStandardValueCommand(input, value, input.node()->GetSplitStandardValue(input.input()))
{}
virtual Project* GetRelevantProject() const override
{
return ref_.node()->project();
}
protected:
virtual void redo() override
{
ref_.node()->SetSplitStandardValue(ref_.input(), new_value_, ref_.element());
}
virtual void undo() override
{
ref_.node()->SetSplitStandardValue(ref_.input(), old_value_, ref_.element());
}
private:
NodeInput ref_;
SplitValue old_value_;
SplitValue new_value_;
};
class NodeParamArrayAppendCommand : public UndoCommand
{
public:
NodeParamArrayAppendCommand(Node* node, const QString& input);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo() override;
virtual void undo() override;
private:
Node* node_;
QString input_;
};
class NodeSetValueHintCommand : public UndoCommand
{
public:
NodeSetValueHintCommand(const NodeInput &input, const Node::ValueHint &hint) :
input_(input),
new_hint_(hint)
{
}
NodeSetValueHintCommand(Node *node, const QString &input, int element, const Node::ValueHint &hint) :
NodeSetValueHintCommand(NodeInput(node, input, element), hint)
{
}
virtual Project* GetRelevantProject() const override
{
return input_.node()->project();
}
protected:
virtual void redo() override;
virtual void undo() override;
private:
NodeInput input_;
Node::ValueHint new_hint_;
Node::ValueHint old_hint_;
};
}
#endif // NODEPARAMVIEWUNDO_H
@@ -30,10 +30,10 @@
#include "core.h"
#include "node/group/group.h"
#include "node/node.h"
#include "node/nodeundo.h"
#include "node/project/sequence/sequence.h"
#include "nodeparamviewarraywidget.h"
#include "nodeparamviewtextedit.h"
#include "nodeparamviewundo.h"
#include "undo/undostack.h"
#include "widget/bezier/bezierwidget.h"
#include "widget/colorbutton/colorbutton.h"