improving actions history
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "node_button_custom.h"
|
||||
#include "node_combobox.h"
|
||||
#include "node_scroll.h"
|
||||
#include "action.h"
|
||||
|
||||
class NodeLayer : public NodeBorder
|
||||
{
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
std::function<void(Node* target, int idx, int mode)> on_layer_blend_mode_changed;
|
||||
std::function<void(Node* target, int index)> on_layer_delete;
|
||||
std::function<void(Node* target, int index)> on_layer_duplicate;
|
||||
std::function<void(Node* target)> on_layer_add;
|
||||
std::function<void(Node* target, std::unique_ptr<class Layer> layer, int index)> on_layer_add;
|
||||
std::function<void(Node* target, int old_idx, int new_idx)> on_layer_order;
|
||||
NodeLayer* m_current_layer = nullptr;
|
||||
std::vector<NodeLayer*> m_layers;
|
||||
@@ -61,9 +62,9 @@ public:
|
||||
virtual void init() override;
|
||||
virtual kEventResult handle_event(Event* e) override;
|
||||
void add_layer();
|
||||
NodeLayer* add_layer(const char* name);
|
||||
NodeLayer* add_layer(const char* name, bool add_history = true, std::unique_ptr<class Layer> layer = nullptr, int index = 0);
|
||||
NodeLayer* get_layer_at(int index);
|
||||
void remove_layer(NodeLayer* layer);
|
||||
void remove_layer(NodeLayer* layer, bool add_history = true);
|
||||
void handle_layer_opacity(NodeLayer* target, float value);
|
||||
void handle_layer_visibility(NodeLayer* target, bool visible);
|
||||
void handle_layer_alpha_lock(NodeLayer* target, bool locked);
|
||||
@@ -73,3 +74,40 @@ public:
|
||||
void clear();
|
||||
void update_attributes();
|
||||
};
|
||||
|
||||
class ActionLayerAdd : public Action
|
||||
{
|
||||
public:
|
||||
NodePanelLayer* m_panel;
|
||||
std::shared_ptr<Node> m_layer_node;
|
||||
int m_layer_order;
|
||||
virtual void run() override { }
|
||||
virtual Action* get_redo() override;
|
||||
virtual void undo() override;
|
||||
virtual size_t memory() override;
|
||||
};
|
||||
|
||||
class ActionLayerRemove : public Action
|
||||
{
|
||||
public:
|
||||
NodePanelLayer* m_panel;
|
||||
std::shared_ptr<Node> m_layer_node;
|
||||
std::unique_ptr<class Layer> m_layer;
|
||||
int m_layer_order;
|
||||
virtual void run() override { }
|
||||
virtual Action* get_redo() override;
|
||||
virtual void undo() override;
|
||||
virtual size_t memory() override;
|
||||
};
|
||||
|
||||
class ActionLayerMove : public Action
|
||||
{
|
||||
public:
|
||||
int m_index_old;
|
||||
int m_index_new;
|
||||
virtual void run() override { }
|
||||
virtual Action* get_redo() override;
|
||||
virtual void undo() override;
|
||||
virtual size_t memory() override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user