comparison layer/TimeInstantLayer.cpp @ 125:999ae0f7d10c

* Change preferences dialog to ok/apply/cancel model * Make preferences persist in a config file * Change instance() to getInstance() for all singleton types * Make pasting to time-value layer with no values in clipboard ask you how to generate the values * Fix bad behaviour caused by importing "data"-type (i.e. 3d dense) model from annotation file without a fixed window size available
author Chris Cannam
date Thu, 27 Jul 2006 16:06:32 +0000
parents 453f7da3534e
children 33929e0c3c6b
comparison
equal deleted inserted replaced
124:bd6e85b3d88b 125:999ae0f7d10c
719 to.addPoint(point); 719 to.addPoint(point);
720 } 720 }
721 } 721 }
722 } 722 }
723 723
724 void 724 bool
725 TimeInstantLayer::paste(const Clipboard &from, int frameOffset) 725 TimeInstantLayer::paste(const Clipboard &from, int frameOffset, bool interactive)
726 { 726 {
727 if (!m_model) return; 727 if (!m_model) return false;
728 728
729 const Clipboard::PointList &points = from.getPoints(); 729 const Clipboard::PointList &points = from.getPoints();
730 730
731 SparseOneDimensionalModel::EditCommand *command = 731 SparseOneDimensionalModel::EditCommand *command =
732 new SparseOneDimensionalModel::EditCommand(m_model, tr("Paste")); 732 new SparseOneDimensionalModel::EditCommand(m_model, tr("Paste"));
738 size_t frame = 0; 738 size_t frame = 0;
739 if (frameOffset > 0 || -frameOffset < i->getFrame()) { 739 if (frameOffset > 0 || -frameOffset < i->getFrame()) {
740 frame = i->getFrame() + frameOffset; 740 frame = i->getFrame() + frameOffset;
741 } 741 }
742 SparseOneDimensionalModel::Point newPoint(frame); 742 SparseOneDimensionalModel::Point newPoint(frame);
743 if (i->haveLabel()) newPoint.label = i->getLabel(); 743 if (i->haveLabel()) {
744 newPoint.label = i->getLabel();
745 } else if (i->haveValue()) {
746 newPoint.label = QString("%1").arg(i->getValue());
747 }
744 748
745 command->addPoint(newPoint); 749 command->addPoint(newPoint);
746 } 750 }
747 751
748 command->finish(); 752 command->finish();
753 return true;
749 } 754 }
750 755
751 QString 756 QString
752 TimeInstantLayer::toXmlString(QString indent, QString extraAttributes) const 757 TimeInstantLayer::toXmlString(QString indent, QString extraAttributes) const
753 { 758 {