diff base/Clipboard.cpp @ 340:516819f2b97b

* Add Erase tool and mode * Add icons for Normalize buttons in property boxes, and for Show Peaks * Add support for velocity in notes -- not yet reflected in display or editable in the note edit dialog, but they are imported from MIDI, played, and exported * Begin work on making pastes align pasted times (subtler than I thought)
author Chris Cannam
date Fri, 23 Nov 2007 16:48:23 +0000
parents 47fd14e29813
children 007b01b971a6 94fc0591ea43
line wrap: on
line diff
--- a/base/Clipboard.cpp	Thu Nov 22 14:17:19 2007 +0000
+++ b/base/Clipboard.cpp	Fri Nov 23 16:48:23 2007 +0000
@@ -21,7 +21,11 @@
     m_haveValue(false),
     m_haveDuration(false),
     m_haveLabel(true),
-    m_label(label)
+    m_label(label),
+    m_haveLevel(false),
+    m_level(0.f),
+    m_haveReferenceFrame(false),
+    m_referenceFrame(frame)
 {
 }
 
@@ -32,7 +36,11 @@
     m_value(value),
     m_haveDuration(false),
     m_haveLabel(true),
-    m_label(label)
+    m_label(label),
+    m_haveLevel(false),
+    m_level(0.f),
+    m_haveReferenceFrame(false),
+    m_referenceFrame(frame)
 {
 }
 
@@ -44,7 +52,27 @@
     m_haveDuration(true),
     m_duration(duration),
     m_haveLabel(true),
-    m_label(label)
+    m_label(label),
+    m_haveLevel(false),
+    m_level(0.f),
+    m_haveReferenceFrame(false),
+    m_referenceFrame(frame)
+{
+}
+
+Clipboard::Point::Point(long frame, float value, size_t duration, float level, QString label) :
+    m_haveFrame(true),
+    m_frame(frame),
+    m_haveValue(true),
+    m_value(value),
+    m_haveDuration(true),
+    m_duration(duration),
+    m_haveLabel(true),
+    m_label(label),
+    m_haveLevel(true),
+    m_level(level),
+    m_haveReferenceFrame(false),
+    m_referenceFrame(frame)
 {
 }
 
@@ -56,7 +84,11 @@
     m_haveDuration(point.m_haveDuration),
     m_duration(point.m_duration),
     m_haveLabel(point.m_haveLabel),
-    m_label(point.m_label)
+    m_label(point.m_label),
+    m_haveLevel(point.m_haveLevel),
+    m_level(point.m_level),
+    m_haveReferenceFrame(point.m_haveReferenceFrame),
+    m_referenceFrame(point.m_referenceFrame)
 {
 }
 
@@ -72,6 +104,10 @@
     m_duration = point.m_duration;
     m_haveLabel = point.m_haveLabel;
     m_label = point.m_label;
+    m_haveLevel = point.m_haveLevel;
+    m_level = point.m_level;
+    m_haveReferenceFrame = point.m_haveReferenceFrame;
+    m_referenceFrame = point.m_referenceFrame;
     return *this;
 }
 
@@ -123,6 +159,37 @@
     return m_label;
 }
 
+bool
+Clipboard::Point::haveLevel() const
+{
+    return m_haveLevel;
+}
+
+float
+Clipboard::Point::getLevel() const
+{
+    return m_level;
+}
+
+bool
+Clipboard::Point::haveReferenceFrame() const
+{
+    return m_haveReferenceFrame;
+}
+
+long
+Clipboard::Point::getReferenceFrame() const
+{
+    return m_referenceFrame;
+}
+
+void
+Clipboard::Point::setReferenceFrame(long f) 
+{
+    if (f != m_frame) m_haveReferenceFrame = true;
+    m_referenceFrame = f;
+}
+
 Clipboard::Clipboard() { }
 Clipboard::~Clipboard() { }
 
@@ -156,3 +223,13 @@
     m_points.push_back(point);
 }
 
+bool
+Clipboard::haveReferenceFrames() const
+{
+    for (PointList::const_iterator i = m_points.begin();
+         i != m_points.end(); ++i) {
+        if (i->haveReferenceFrame()) return true;
+    } 
+    return false;
+}
+