Clipboard introduced, but not incorporated yet. Some defines for convenience and better readability.

This commit is contained in:
Sebastian
2024-11-19 01:04:06 +01:00
parent 22842f9deb
commit 5779c93339
11 changed files with 118 additions and 44 deletions
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include "midi-node.h"
#include "node.h"
namespace VISEQ::APP {
class Clipboard {
public:
Clipboard() {}
GRAPH::NODES::VEC_SPTR_Node clipboard;
GRAPH::NODES::VEC_SPTR_Node pasteNodes(){
return clipboard;
}
void copyNodes(GRAPH::NODES::VEC_SPTR_Node _nodes, Vec2Df position){
for(auto n: _nodes){
copyNode(n, position + n->drag_offset);
}
}
void copyNodes(std::vector<std::shared_ptr<GRAPH::NODES::MidiNode>> _nodes, Vec2Df position){
for(auto n: _nodes){
copyNode(n, position + n->drag_offset);
}
}
GRAPH::NODES::SPTR_Node copyNode(GRAPH::NODES::SPTR_Node n, Vec2Df position){
std::cout << "copy basenode" << std::endl;
clipboard.insert(clipboard.end(), std::make_shared<GRAPH::NODES::Node>(*n));
clipboard.back()->setPosition(position);
return clipboard.back();
}
GRAPH::NODES::SPTR_Node copyNode(std::shared_ptr<GRAPH::NODES::MidiNode> n, Vec2Df position){
std::cout << "copy midinode" << std::endl;
clipboard.insert(clipboard.end(), std::make_shared<GRAPH::NODES::MidiNode>(*n));
clipboard.back()->setPosition(position);
return clipboard.back();
}
};
}