# HG changeset patch # User Chris Cannam # Date 1193322743 0 # Node ID a71dec01c4d3616ff8b27ad0c4db099bd147d344 # Parent 7623ecfd589158d56d584218cd6e6e979f8e1122 * Some tidying up to handling of alignment; add alignment status label to pane; ensure alignment when dragging with mouse as well as when playing diff -r 7623ecfd5891 -r a71dec01c4d3 data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Thu Oct 25 14:30:32 2007 +0000 +++ b/data/model/AlignmentModel.cpp Thu Oct 25 14:32:23 2007 +0000 @@ -26,6 +26,7 @@ m_inputModel(inputModel), m_path(path), m_reversePath(0), + m_pathBegun(false), m_pathComplete(false) { connect(m_path, SIGNAL(modelChanged()), @@ -89,6 +90,10 @@ bool AlignmentModel::isReady(int *completion) const { + if (!m_pathBegun) { + completion = 0; + return false; + } return m_path->isReady(completion); } @@ -140,18 +145,21 @@ void AlignmentModel::pathCompletionChanged() { + m_pathBegun = true; + if (!m_pathComplete) { int completion = 0; m_path->isReady(&completion); std::cerr << "AlignmentModel::pathCompletionChanged: completion = " << completion << std::endl; - m_pathComplete = (completion == 100); //!!! a bit of a hack + m_pathComplete = (completion == 100); if (m_pathComplete) { constructReversePath(); delete m_inputModel; m_inputModel = 0; } } + emit completionChanged(); } diff -r 7623ecfd5891 -r a71dec01c4d3 data/model/AlignmentModel.h --- a/data/model/AlignmentModel.h Thu Oct 25 14:30:32 2007 +0000 +++ b/data/model/AlignmentModel.h Thu Oct 25 14:32:23 2007 +0000 @@ -62,6 +62,7 @@ Model *m_inputModel; // I own this SparseTimeValueModel *m_path; // I own this mutable SparseTimeValueModel *m_reversePath; // I own this + bool m_pathBegun; bool m_pathComplete; void constructReversePath() const; diff -r 7623ecfd5891 -r a71dec01c4d3 data/model/Model.cpp --- a/data/model/Model.cpp Thu Oct 25 14:30:32 2007 +0000 +++ b/data/model/Model.cpp Thu Oct 25 14:32:23 2007 +0000 @@ -96,7 +96,7 @@ const Model * Model::getAlignmentReference() const { - if (!m_alignment) return 0; + if (!m_alignment) return this; return m_alignment->getReferenceModel(); } @@ -117,11 +117,11 @@ int Model::getAlignmentCompletion() const { - std::cerr << "Model::getAlignmentCompletion" << std::endl; +// std::cerr << "Model::getAlignmentCompletion" << std::endl; if (!m_alignment) return 100; int completion = 0; (void)m_alignment->isReady(&completion); - std::cerr << " -> " << completion << std::endl; +// std::cerr << " -> " << completion << std::endl; return completion; }