Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.cpp @ 1423:62e908518c71 single-point
Update to Event api in place of Clipboard points
author | Chris Cannam |
---|---|
date | Fri, 08 Mar 2019 13:37:30 +0000 |
parents | c8a6fd3f9dff |
children | e1a08da75427 |
comparison
equal
deleted
inserted
replaced
1422:6f51297a0250 | 1423:62e908518c71 |
---|---|
1738 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 1738 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
1739 | 1739 |
1740 for (FlexiNoteModel::PointList::iterator i = points.begin(); | 1740 for (FlexiNoteModel::PointList::iterator i = points.begin(); |
1741 i != points.end(); ++i) { | 1741 i != points.end(); ++i) { |
1742 if (s.contains(i->frame)) { | 1742 if (s.contains(i->frame)) { |
1743 Clipboard::Point point(i->frame, i->value, i->duration, i->level, i->label); | 1743 Event point(i->frame, i->value, i->duration, i->level, i->label); |
1744 point.setReferenceFrame(alignToReference(v, i->frame)); | 1744 to.addPoint(point.withReferenceFrame(alignToReference(v, i->frame))); |
1745 to.addPoint(point); | |
1746 } | 1745 } |
1747 } | 1746 } |
1748 } | 1747 } |
1749 | 1748 |
1750 bool | 1749 bool |
1751 FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /*frameOffset */, bool /* interactive */) | 1750 FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /*frameOffset */, bool /* interactive */) |
1752 { | 1751 { |
1753 if (!m_model) return false; | 1752 if (!m_model) return false; |
1754 | 1753 |
1755 const Clipboard::PointList &points = from.getPoints(); | 1754 const EventVector &points = from.getPoints(); |
1756 | 1755 |
1757 bool realign = false; | 1756 bool realign = false; |
1758 | 1757 |
1759 if (clipboardHasDifferentAlignment(v, from)) { | 1758 if (clipboardHasDifferentAlignment(v, from)) { |
1760 | 1759 |
1774 } | 1773 } |
1775 | 1774 |
1776 FlexiNoteModel::EditCommand *command = | 1775 FlexiNoteModel::EditCommand *command = |
1777 new FlexiNoteModel::EditCommand(m_model, tr("Paste")); | 1776 new FlexiNoteModel::EditCommand(m_model, tr("Paste")); |
1778 | 1777 |
1779 for (Clipboard::PointList::const_iterator i = points.begin(); | 1778 for (EventVector::const_iterator i = points.begin(); |
1780 i != points.end(); ++i) { | 1779 i != points.end(); ++i) { |
1781 | 1780 |
1782 if (!i->haveFrame()) continue; | |
1783 sv_frame_t frame = 0; | 1781 sv_frame_t frame = 0; |
1784 | 1782 |
1785 if (!realign) { | 1783 if (!realign) { |
1786 | 1784 |
1787 frame = i->getFrame(); | 1785 frame = i->getFrame(); |
1788 | 1786 |
1789 } else { | 1787 } else { |
1790 | 1788 |
1791 if (i->haveReferenceFrame()) { | 1789 if (i->hasReferenceFrame()) { |
1792 frame = i->getReferenceFrame(); | 1790 frame = i->getReferenceFrame(); |
1793 frame = alignFromReference(v, frame); | 1791 frame = alignFromReference(v, frame); |
1794 } else { | 1792 } else { |
1795 frame = i->getFrame(); | 1793 frame = i->getFrame(); |
1796 } | 1794 } |
1797 } | 1795 } |
1798 | 1796 |
1799 FlexiNoteModel::Point newPoint(frame); | 1797 FlexiNoteModel::Point newPoint(frame); |
1800 | 1798 |
1801 if (i->haveLabel()) newPoint.label = i->getLabel(); | 1799 if (i->hasLabel()) newPoint.label = i->getLabel(); |
1802 if (i->haveValue()) newPoint.value = i->getValue(); | 1800 if (i->hasValue()) newPoint.value = i->getValue(); |
1803 else newPoint.value = (m_model->getValueMinimum() + | 1801 else newPoint.value = (m_model->getValueMinimum() + |
1804 m_model->getValueMaximum()) / 2; | 1802 m_model->getValueMaximum()) / 2; |
1805 if (i->haveLevel()) newPoint.level = i->getLevel(); | 1803 if (i->hasLevel()) newPoint.level = i->getLevel(); |
1806 if (i->haveDuration()) newPoint.duration = i->getDuration(); | 1804 if (i->hasDuration()) newPoint.duration = i->getDuration(); |
1807 else { | 1805 else { |
1808 sv_frame_t nextFrame = frame; | 1806 sv_frame_t nextFrame = frame; |
1809 Clipboard::PointList::const_iterator j = i; | 1807 EventVector::const_iterator j = i; |
1810 for (; j != points.end(); ++j) { | 1808 for (; j != points.end(); ++j) { |
1811 if (!j->haveFrame()) continue; | |
1812 if (j != i) break; | 1809 if (j != i) break; |
1813 } | 1810 } |
1814 if (j != points.end()) { | 1811 if (j != points.end()) { |
1815 nextFrame = j->getFrame(); | 1812 nextFrame = j->getFrame(); |
1816 } | 1813 } |