F.E.I.S/NotesClipboard.cpp
Stepland 8d44098063 - Tab selection in linear view
- Cut/Copy/Paste selected notes
- LN displayed correctly in the Linear View
- bunch of other small stuff
2019-03-27 20:37:30 +01:00

28 lines
741 B
C++

//
// Created by Syméon on 27/03/2019.
//
#include "NotesClipboard.h"
NotesClipboard::NotesClipboard(const std::set<Note> &notes) {
copy(notes);
}
void NotesClipboard::copy(const std::set<Note> &notes) {
contents.clear();
if (not notes.empty()) {
int timing_offset = notes.cbegin()->getTiming();
for (const auto &note : notes) {
contents.emplace(note.getPos(), note.getTiming()-timing_offset, note.getLength(), note.getTail_pos());
}
}
}
std::set<Note> NotesClipboard::paste(int tick_offset) {
std::set<Note> res = {};
for (auto note : contents) {
res.emplace(note.getPos(), note.getTiming()+tick_offset, note.getLength(), note.getTail_pos());
}
return res;
}