comparison 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
comparison
equal deleted inserted replaced
370:e73a1a1e8f24 371:d77e1fa49e26
28 m_path(0), 28 m_path(0),
29 m_reversePath(0), 29 m_reversePath(0),
30 m_pathBegun(false), 30 m_pathBegun(false),
31 m_pathComplete(false) 31 m_pathComplete(false)
32 { 32 {
33 connect(m_rawPath, SIGNAL(modelChanged()), 33 if (m_rawPath) {
34 this, SLOT(pathChanged())); 34
35 35 connect(m_rawPath, SIGNAL(modelChanged()),
36 connect(m_rawPath, SIGNAL(modelChanged(size_t, size_t)), 36 this, SLOT(pathChanged()));
37 this, SLOT(pathChanged(size_t, size_t))); 37
38 38 connect(m_rawPath, SIGNAL(modelChanged(size_t, size_t)),
39 connect(m_rawPath, SIGNAL(completionChanged()), 39 this, SLOT(pathChanged(size_t, size_t)));
40 this, SLOT(pathCompletionChanged())); 40
41 connect(m_rawPath, SIGNAL(completionChanged()),
42 this, SLOT(pathCompletionChanged()));
43 }
41 44
42 constructPath(); 45 constructPath();
43 constructReversePath(); 46 constructReversePath();
44 } 47 }
45 48
123 126
124 size_t 127 size_t
125 AlignmentModel::toReference(size_t frame) const 128 AlignmentModel::toReference(size_t frame) const
126 { 129 {
127 // std::cerr << "AlignmentModel::toReference(" << frame << ")" << std::endl; 130 // std::cerr << "AlignmentModel::toReference(" << frame << ")" << std::endl;
128 if (!m_path) constructPath(); 131 if (!m_path) {
132 if (!m_rawPath) return frame;
133 constructPath();
134 }
129 return align(m_path, frame); 135 return align(m_path, frame);
130 } 136 }
131 137
132 size_t 138 size_t
133 AlignmentModel::fromReference(size_t frame) const 139 AlignmentModel::fromReference(size_t frame) const
134 { 140 {
135 // std::cerr << "AlignmentModel::fromReference(" << frame << ")" << std::endl; 141 // std::cerr << "AlignmentModel::fromReference(" << frame << ")" << std::endl;
136 if (!m_reversePath) constructReversePath(); 142 if (!m_reversePath) {
143 if (!m_rawPath) return frame;
144 constructReversePath();
145 }
137 return align(m_reversePath, frame); 146 return align(m_reversePath, frame);
138 } 147 }
139 148
140 void 149 void
141 AlignmentModel::pathChanged() 150 AlignmentModel::pathChanged()