Mercurial > hg > svgui
comparison layer/ImageLayer.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 | 09d008b5c8f4 |
comparison
equal
deleted
inserted
replaced
1422:6f51297a0250 | 1423:62e908518c71 |
---|---|
809 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 809 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
810 | 810 |
811 for (ImageModel::PointList::iterator i = points.begin(); | 811 for (ImageModel::PointList::iterator i = points.begin(); |
812 i != points.end(); ++i) { | 812 i != points.end(); ++i) { |
813 if (s.contains(i->frame)) { | 813 if (s.contains(i->frame)) { |
814 Clipboard::Point point(i->frame, i->label); | 814 Event point(i->frame, i->label); |
815 point.setReferenceFrame(alignToReference(v, i->frame)); | 815 to.addPoint(point.withReferenceFrame(alignToReference(v, i->frame))); |
816 to.addPoint(point); | |
817 } | 816 } |
818 } | 817 } |
819 } | 818 } |
820 | 819 |
821 bool | 820 bool |
822 ImageLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */) | 821 ImageLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */) |
823 { | 822 { |
824 if (!m_model) return false; | 823 if (!m_model) return false; |
825 | 824 |
826 const Clipboard::PointList &points = from.getPoints(); | 825 const EventVector &points = from.getPoints(); |
827 | 826 |
828 bool realign = false; | 827 bool realign = false; |
829 | 828 |
830 if (clipboardHasDifferentAlignment(v, from)) { | 829 if (clipboardHasDifferentAlignment(v, from)) { |
831 | 830 |
845 } | 844 } |
846 | 845 |
847 ImageModel::EditCommand *command = | 846 ImageModel::EditCommand *command = |
848 new ImageModel::EditCommand(m_model, tr("Paste")); | 847 new ImageModel::EditCommand(m_model, tr("Paste")); |
849 | 848 |
850 for (Clipboard::PointList::const_iterator i = points.begin(); | 849 for (EventVector::const_iterator i = points.begin(); |
851 i != points.end(); ++i) { | 850 i != points.end(); ++i) { |
852 | 851 |
853 if (!i->haveFrame()) continue; | |
854 | |
855 sv_frame_t frame = 0; | 852 sv_frame_t frame = 0; |
856 | 853 |
857 if (!realign) { | 854 if (!realign) { |
858 | 855 |
859 frame = i->getFrame(); | 856 frame = i->getFrame(); |
860 | 857 |
861 } else { | 858 } else { |
862 | 859 |
863 if (i->haveReferenceFrame()) { | 860 if (i->hasReferenceFrame()) { |
864 frame = i->getReferenceFrame(); | 861 frame = i->getReferenceFrame(); |
865 frame = alignFromReference(v, frame); | 862 frame = alignFromReference(v, frame); |
866 } else { | 863 } else { |
867 frame = i->getFrame(); | 864 frame = i->getFrame(); |
868 } | 865 } |
870 | 867 |
871 ImageModel::Point newPoint(frame); | 868 ImageModel::Point newPoint(frame); |
872 | 869 |
873 //!!! inadequate | 870 //!!! inadequate |
874 | 871 |
875 if (i->haveLabel()) { | 872 if (i->hasLabel()) { |
876 newPoint.label = i->getLabel(); | 873 newPoint.label = i->getLabel(); |
877 } else if (i->haveValue()) { | 874 } else if (i->hasValue()) { |
878 newPoint.label = QString("%1").arg(i->getValue()); | 875 newPoint.label = QString("%1").arg(i->getValue()); |
879 } else { | 876 } else { |
880 newPoint.label = tr("New Point"); | 877 newPoint.label = tr("New Point"); |
881 } | 878 } |
882 | 879 |