Mercurial > hg > svgui
comparison layer/TimeInstantLayer.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 | 9abddbd57667 |
comparison
equal
deleted
inserted
replaced
1422:6f51297a0250 | 1423:62e908518c71 |
---|---|
759 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 759 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
760 | 760 |
761 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); | 761 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); |
762 i != points.end(); ++i) { | 762 i != points.end(); ++i) { |
763 if (s.contains(i->frame)) { | 763 if (s.contains(i->frame)) { |
764 Clipboard::Point point(i->frame, i->label); | 764 Event point(i->frame, i->label); |
765 point.setReferenceFrame(alignToReference(v, i->frame)); | 765 to.addPoint(point.withReferenceFrame(alignToReference(v, i->frame))); |
766 to.addPoint(point); | |
767 } | 766 } |
768 } | 767 } |
769 } | 768 } |
770 | 769 |
771 bool | 770 bool |
772 TimeInstantLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, bool) | 771 TimeInstantLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, bool) |
773 { | 772 { |
774 if (!m_model) return false; | 773 if (!m_model) return false; |
775 | 774 |
776 const Clipboard::PointList &points = from.getPoints(); | 775 const EventVector &points = from.getPoints(); |
777 | 776 |
778 bool realign = false; | 777 bool realign = false; |
779 | 778 |
780 if (clipboardHasDifferentAlignment(v, from)) { | 779 if (clipboardHasDifferentAlignment(v, from)) { |
781 | 780 |
795 } | 794 } |
796 | 795 |
797 SparseOneDimensionalModel::EditCommand *command = | 796 SparseOneDimensionalModel::EditCommand *command = |
798 new SparseOneDimensionalModel::EditCommand(m_model, tr("Paste")); | 797 new SparseOneDimensionalModel::EditCommand(m_model, tr("Paste")); |
799 | 798 |
800 for (Clipboard::PointList::const_iterator i = points.begin(); | 799 for (EventVector::const_iterator i = points.begin(); |
801 i != points.end(); ++i) { | 800 i != points.end(); ++i) { |
802 | 801 |
803 if (!i->haveFrame()) continue; | |
804 | |
805 sv_frame_t frame = 0; | 802 sv_frame_t frame = 0; |
806 | 803 |
807 if (!realign) { | 804 if (!realign) { |
808 | 805 |
809 frame = i->getFrame(); | 806 frame = i->getFrame(); |
810 | 807 |
811 } else { | 808 } else { |
812 | 809 |
813 if (i->haveReferenceFrame()) { | 810 if (i->hasReferenceFrame()) { |
814 frame = i->getReferenceFrame(); | 811 frame = i->getReferenceFrame(); |
815 frame = alignFromReference(v, frame); | 812 frame = alignFromReference(v, frame); |
816 } else { | 813 } else { |
817 frame = i->getFrame(); | 814 frame = i->getFrame(); |
818 } | 815 } |
823 if (frame > -frameOffset) frame += frameOffset; | 820 if (frame > -frameOffset) frame += frameOffset; |
824 else frame = 0; | 821 else frame = 0; |
825 } | 822 } |
826 | 823 |
827 SparseOneDimensionalModel::Point newPoint(frame); | 824 SparseOneDimensionalModel::Point newPoint(frame); |
828 if (i->haveLabel()) { | 825 if (i->hasLabel()) { |
829 newPoint.label = i->getLabel(); | 826 newPoint.label = i->getLabel(); |
830 } else if (i->haveValue()) { | 827 } else if (i->hasValue()) { |
831 newPoint.label = QString("%1").arg(i->getValue()); | 828 newPoint.label = QString("%1").arg(i->getValue()); |
832 } | 829 } |
833 | 830 |
834 command->addPoint(newPoint); | 831 command->addPoint(newPoint); |
835 } | 832 } |