changeset 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 e73a1a1e8f24
children d31b4ccb7ddb
files data/model/AlignmentModel.cpp data/model/Model.cpp
diffstat 2 files changed, 18 insertions(+), 9 deletions(-) [+]
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);
 }
 
--- a/data/model/Model.cpp	Mon Feb 04 16:48:52 2008 +0000
+++ b/data/model/Model.cpp	Wed Feb 06 12:49:49 2008 +0000
@@ -102,7 +102,7 @@
 {
     if (!m_alignment) {
         if (m_sourceModel) return m_sourceModel->getAlignmentReference();
-        return this;
+        return 0;
     }
     return m_alignment->getReferenceModel();
 }