Mercurial > hg > tony
diff src/Analyser.cpp @ 349:ff00432761ce
Single-click to move pointer needs to wait for double-click timeout (so it knows you're not starting a double-click)
author | Chris Cannam |
---|---|
date | Mon, 16 Jun 2014 12:50:27 +0100 |
parents | 6b57c58b88d2 |
children | fc0c4cfad044 |
line wrap: on
line diff
--- a/src/Analyser.cpp Mon Jun 16 11:49:05 2014 +0100 +++ b/src/Analyser.cpp Mon Jun 16 12:50:27 2014 +0100 @@ -537,56 +537,58 @@ vector<Layer *> primary, vector<Layer *> additional) { - QMutexLocker locker(&m_asyncMutex); + { + QMutexLocker locker(&m_asyncMutex); - if (handle != m_currentAsyncHandle || - m_reAnalysingSelection == Selection()) { - // We don't want these! + if (handle != m_currentAsyncHandle || + m_reAnalysingSelection == Selection()) { + // We don't want these! + for (int i = 0; i < (int)primary.size(); ++i) { + m_document->deleteLayer(primary[i]); + } + for (int i = 0; i < (int)additional.size(); ++i) { + m_document->deleteLayer(additional[i]); + } + return; + } + m_currentAsyncHandle = 0; + + CommandHistory::getInstance()->startCompoundOperation + (tr("Re-Analyse Selection"), true); + + m_reAnalysisCandidates.clear(); + + vector<Layer *> all; for (int i = 0; i < (int)primary.size(); ++i) { - m_document->deleteLayer(primary[i]); + all.push_back(primary[i]); } for (int i = 0; i < (int)additional.size(); ++i) { - m_document->deleteLayer(additional[i]); + all.push_back(additional[i]); } - return; + + for (int i = 0; i < (int)all.size(); ++i) { + TimeValueLayer *t = qobject_cast<TimeValueLayer *>(all[i]); + if (t) { + PlayParameters *params = t->getPlayParameters(); + if (params) { + params->setPlayAudible(false); + } + t->setBaseColour + (ColourDatabase::getInstance()->getColourIndex(tr("Bright Orange"))); + t->setPresentationName("candidate"); + m_document->addLayerToView(m_pane, t); + m_reAnalysisCandidates.push_back(t); + } + } + + if (!all.empty()) { + bool show = m_candidatesVisible; + m_candidatesVisible = !show; // to ensure the following takes effect + showPitchCandidates(show); + } + + CommandHistory::getInstance()->endCompoundOperation(); } - m_currentAsyncHandle = 0; - - CommandHistory::getInstance()->startCompoundOperation - (tr("Re-Analyse Selection"), true); - - m_reAnalysisCandidates.clear(); - - vector<Layer *> all; - for (int i = 0; i < (int)primary.size(); ++i) { - all.push_back(primary[i]); - } - for (int i = 0; i < (int)additional.size(); ++i) { - all.push_back(additional[i]); - } - - for (int i = 0; i < (int)all.size(); ++i) { - TimeValueLayer *t = qobject_cast<TimeValueLayer *>(all[i]); - if (t) { - PlayParameters *params = t->getPlayParameters(); - if (params) { - params->setPlayAudible(false); - } - t->setBaseColour - (ColourDatabase::getInstance()->getColourIndex(tr("Bright Orange"))); - t->setPresentationName("candidate"); - m_document->addLayerToView(m_pane, t); - m_reAnalysisCandidates.push_back(t); - } - } - - if (!all.empty()) { - bool show = m_candidatesVisible; - m_candidatesVisible = !show; // to ensure the following takes effect - showPitchCandidates(show); - } - - CommandHistory::getInstance()->endCompoundOperation(); emit layersChanged(); }