copy/paste partially. z-index experiments, but not working yet.

This commit is contained in:
Sebastian
2024-11-21 02:03:32 +01:00
parent df91a1b107
commit bfc14d5f6e
10 changed files with 172 additions and 139 deletions
+7 -28
View File
@@ -1,6 +1,5 @@
#pragma once
#include "midi-node.h"
#include "node.h"
namespace VISEQ::APP {
@@ -8,36 +7,16 @@ namespace VISEQ::APP {
public:
Clipboard() {}
GRAPH::NODES::VEC_SPTR_Node clipboard;
std::vector<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);
GRAPH::NODES::VEC_SPTR_Node pullNodes(){
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();
void pushNodes(GRAPH::NODES::VEC_SPTR_Node selected_nodes){
clipboard.emplace_back();
std::ranges::copy(selected_nodes.begin(), selected_nodes.end(), std::back_inserter(clipboard.back()));
std::ranges::for_each(selected_nodes.begin(), selected_nodes.end(), [](GRAPH::NODES::SPTR_Node n){n->selected = false;});
}
};