changeset 370:e73a1a1e8f24

* more reference frame records
author Chris Cannam
date Mon, 04 Feb 2008 16:48:52 +0000
parents 007b01b971a6
children d77e1fa49e26
files base/Clipboard.cpp base/Clipboard.h
diffstat 2 files changed, 31 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/base/Clipboard.cpp	Mon Feb 04 13:35:11 2008 +0000
+++ b/base/Clipboard.cpp	Mon Feb 04 16:48:52 2008 +0000
@@ -24,7 +24,7 @@
     m_label(label),
     m_haveLevel(false),
     m_level(0.f),
-    m_referenceFramesDiffer(false),
+    m_haveReferenceFrame(false),
     m_referenceFrame(frame)
 {
 }
@@ -39,7 +39,7 @@
     m_label(label),
     m_haveLevel(false),
     m_level(0.f),
-    m_referenceFramesDiffer(false),
+    m_haveReferenceFrame(false),
     m_referenceFrame(frame)
 {
 }
@@ -55,7 +55,7 @@
     m_label(label),
     m_haveLevel(false),
     m_level(0.f),
-    m_referenceFramesDiffer(false),
+    m_haveReferenceFrame(false),
     m_referenceFrame(frame)
 {
 }
@@ -71,7 +71,7 @@
     m_label(label),
     m_haveLevel(true),
     m_level(level),
-    m_referenceFramesDiffer(false),
+    m_haveReferenceFrame(false),
     m_referenceFrame(frame)
 {
 }
@@ -87,7 +87,7 @@
     m_label(point.m_label),
     m_haveLevel(point.m_haveLevel),
     m_level(point.m_level),
-    m_referenceFramesDiffer(point.m_referenceFramesDiffer),
+    m_haveReferenceFrame(point.m_haveReferenceFrame),
     m_referenceFrame(point.m_referenceFrame)
 {
 }
@@ -106,7 +106,7 @@
     m_label = point.m_label;
     m_haveLevel = point.m_haveLevel;
     m_level = point.m_level;
-    m_referenceFramesDiffer = point.m_referenceFramesDiffer;
+    m_haveReferenceFrame = point.m_haveReferenceFrame;
     m_referenceFrame = point.m_referenceFrame;
     return *this;
 }
@@ -172,9 +172,15 @@
 }
 
 bool
-Clipboard::Point::referenceFramesDiffer() const
+Clipboard::Point::haveReferenceFrame() const
 {
-    return m_referenceFramesDiffer;
+    return m_haveReferenceFrame;
+}
+
+bool
+Clipboard::Point::referenceFrameDiffers() const
+{
+    return m_haveReferenceFrame && (m_referenceFrame != m_frame);
 }
 
 long
@@ -186,7 +192,7 @@
 void
 Clipboard::Point::setReferenceFrame(long f) 
 {
-    if (f != m_frame) m_referenceFramesDiffer = true;
+    m_haveReferenceFrame = true;
     m_referenceFrame = f;
 }
 
@@ -224,11 +230,21 @@
 }
 
 bool
+Clipboard::haveReferenceFrames() const
+{
+    for (PointList::const_iterator i = m_points.begin();
+         i != m_points.end(); ++i) {
+        if (i->haveReferenceFrame()) return true;
+    } 
+    return false;
+}
+
+bool
 Clipboard::referenceFramesDiffer() const
 {
     for (PointList::const_iterator i = m_points.begin();
          i != m_points.end(); ++i) {
-        if (i->referenceFramesDiffer()) return true;
+        if (i->referenceFrameDiffers()) return true;
     } 
     return false;
 }
--- a/base/Clipboard.h	Mon Feb 04 13:35:11 2008 +0000
+++ b/base/Clipboard.h	Mon Feb 04 16:48:52 2008 +0000
@@ -47,7 +47,9 @@
         bool haveLevel() const;
         float getLevel() const;
 
-        bool referenceFramesDiffer() const;
+        bool haveReferenceFrame() const;
+        bool referenceFrameDiffers() const; // from point frame
+
         long getReferenceFrame() const;
         void setReferenceFrame(long);
 
@@ -62,7 +64,7 @@
         QString m_label;
         bool m_haveLevel;
         float m_level;
-        bool m_referenceFramesDiffer;
+        bool m_haveReferenceFrame;
         long m_referenceFrame;
     };
 
@@ -77,6 +79,7 @@
     void setPoints(const PointList &points);
     void addPoint(const Point &point);
 
+    bool haveReferenceFrames() const;
     bool referenceFramesDiffer() const;
 
 protected: