comparison data/model/AlignmentModel.cpp @ 323:a71dec01c4d3

* Some tidying up to handling of alignment; add alignment status label to pane; ensure alignment when dragging with mouse as well as when playing
author Chris Cannam
date Thu, 25 Oct 2007 14:32:23 +0000
parents 29485aa03da4
children 1afaf98dbf11
comparison
equal deleted inserted replaced
322:7623ecfd5891 323:a71dec01c4d3
24 m_reference(reference), 24 m_reference(reference),
25 m_aligned(aligned), 25 m_aligned(aligned),
26 m_inputModel(inputModel), 26 m_inputModel(inputModel),
27 m_path(path), 27 m_path(path),
28 m_reversePath(0), 28 m_reversePath(0),
29 m_pathBegun(false),
29 m_pathComplete(false) 30 m_pathComplete(false)
30 { 31 {
31 connect(m_path, SIGNAL(modelChanged()), 32 connect(m_path, SIGNAL(modelChanged()),
32 this, SLOT(pathChanged())); 33 this, SLOT(pathChanged()));
33 34
87 } 88 }
88 89
89 bool 90 bool
90 AlignmentModel::isReady(int *completion) const 91 AlignmentModel::isReady(int *completion) const
91 { 92 {
93 if (!m_pathBegun) {
94 completion = 0;
95 return false;
96 }
92 return m_path->isReady(completion); 97 return m_path->isReady(completion);
93 } 98 }
94 99
95 const ZoomConstraint * 100 const ZoomConstraint *
96 AlignmentModel::getZoomConstraint() const 101 AlignmentModel::getZoomConstraint() const
138 } 143 }
139 144
140 void 145 void
141 AlignmentModel::pathCompletionChanged() 146 AlignmentModel::pathCompletionChanged()
142 { 147 {
148 m_pathBegun = true;
149
143 if (!m_pathComplete) { 150 if (!m_pathComplete) {
144 int completion = 0; 151 int completion = 0;
145 m_path->isReady(&completion); 152 m_path->isReady(&completion);
146 std::cerr << "AlignmentModel::pathCompletionChanged: completion = " 153 std::cerr << "AlignmentModel::pathCompletionChanged: completion = "
147 << completion << std::endl; 154 << completion << std::endl;
148 m_pathComplete = (completion == 100); //!!! a bit of a hack 155 m_pathComplete = (completion == 100);
149 if (m_pathComplete) { 156 if (m_pathComplete) {
150 constructReversePath(); 157 constructReversePath();
151 delete m_inputModel; 158 delete m_inputModel;
152 m_inputModel = 0; 159 m_inputModel = 0;
153 } 160 }
154 } 161 }
162
155 emit completionChanged(); 163 emit completionChanged();
156 } 164 }
157 165
158 void 166 void
159 AlignmentModel::constructReversePath() const 167 AlignmentModel::constructReversePath() const