diff data/model/AlignmentModel.cpp @ 371:d77e1fa49e26

* More work on aligning copy/paste between layers. It's a surprisingly complicated business.
author Chris Cannam
date Wed, 06 Feb 2008 12:49:49 +0000
parents ba30f4a3e3be
children ab24af1271e9
line wrap: on
line diff
--- a/data/model/AlignmentModel.cpp	Mon Feb 04 16:48:52 2008 +0000
+++ b/data/model/AlignmentModel.cpp	Wed Feb 06 12:49:49 2008 +0000
@@ -30,14 +30,17 @@
     m_pathBegun(false),
     m_pathComplete(false)
 {
-    connect(m_rawPath, SIGNAL(modelChanged()),
-            this, SLOT(pathChanged()));
+    if (m_rawPath) {
 
-    connect(m_rawPath, SIGNAL(modelChanged(size_t, size_t)),
-            this, SLOT(pathChanged(size_t, size_t)));
+        connect(m_rawPath, SIGNAL(modelChanged()),
+                this, SLOT(pathChanged()));
 
-    connect(m_rawPath, SIGNAL(completionChanged()),
-            this, SLOT(pathCompletionChanged()));
+        connect(m_rawPath, SIGNAL(modelChanged(size_t, size_t)),
+                this, SLOT(pathChanged(size_t, size_t)));
+        
+        connect(m_rawPath, SIGNAL(completionChanged()),
+                this, SLOT(pathCompletionChanged()));
+    }
 
     constructPath();
     constructReversePath();
@@ -125,7 +128,10 @@
 AlignmentModel::toReference(size_t frame) const
 {
 //    std::cerr << "AlignmentModel::toReference(" << frame << ")" << std::endl;
-    if (!m_path) constructPath();
+    if (!m_path) {
+        if (!m_rawPath) return frame;
+        constructPath();
+    }
     return align(m_path, frame);
 }
 
@@ -133,7 +139,10 @@
 AlignmentModel::fromReference(size_t frame) const
 {
 //    std::cerr << "AlignmentModel::fromReference(" << frame << ")" << std::endl;
-    if (!m_reversePath) constructReversePath();
+    if (!m_reversePath) {
+        if (!m_rawPath) return frame;
+        constructReversePath();
+    }
     return align(m_reversePath, frame);
 }