Mercurial > hg > tony
comparison 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 |
comparison
equal
deleted
inserted
replaced
344:80f2cd8a30f7 | 349:ff00432761ce |
---|---|
535 void | 535 void |
536 Analyser::layersCreated(Document::LayerCreationAsyncHandle handle, | 536 Analyser::layersCreated(Document::LayerCreationAsyncHandle handle, |
537 vector<Layer *> primary, | 537 vector<Layer *> primary, |
538 vector<Layer *> additional) | 538 vector<Layer *> additional) |
539 { | 539 { |
540 QMutexLocker locker(&m_asyncMutex); | 540 { |
541 | 541 QMutexLocker locker(&m_asyncMutex); |
542 if (handle != m_currentAsyncHandle || | 542 |
543 m_reAnalysingSelection == Selection()) { | 543 if (handle != m_currentAsyncHandle || |
544 // We don't want these! | 544 m_reAnalysingSelection == Selection()) { |
545 // We don't want these! | |
546 for (int i = 0; i < (int)primary.size(); ++i) { | |
547 m_document->deleteLayer(primary[i]); | |
548 } | |
549 for (int i = 0; i < (int)additional.size(); ++i) { | |
550 m_document->deleteLayer(additional[i]); | |
551 } | |
552 return; | |
553 } | |
554 m_currentAsyncHandle = 0; | |
555 | |
556 CommandHistory::getInstance()->startCompoundOperation | |
557 (tr("Re-Analyse Selection"), true); | |
558 | |
559 m_reAnalysisCandidates.clear(); | |
560 | |
561 vector<Layer *> all; | |
545 for (int i = 0; i < (int)primary.size(); ++i) { | 562 for (int i = 0; i < (int)primary.size(); ++i) { |
546 m_document->deleteLayer(primary[i]); | 563 all.push_back(primary[i]); |
547 } | 564 } |
548 for (int i = 0; i < (int)additional.size(); ++i) { | 565 for (int i = 0; i < (int)additional.size(); ++i) { |
549 m_document->deleteLayer(additional[i]); | 566 all.push_back(additional[i]); |
550 } | 567 } |
551 return; | 568 |
552 } | 569 for (int i = 0; i < (int)all.size(); ++i) { |
553 m_currentAsyncHandle = 0; | 570 TimeValueLayer *t = qobject_cast<TimeValueLayer *>(all[i]); |
554 | 571 if (t) { |
555 CommandHistory::getInstance()->startCompoundOperation | 572 PlayParameters *params = t->getPlayParameters(); |
556 (tr("Re-Analyse Selection"), true); | 573 if (params) { |
557 | 574 params->setPlayAudible(false); |
558 m_reAnalysisCandidates.clear(); | 575 } |
559 | 576 t->setBaseColour |
560 vector<Layer *> all; | 577 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Orange"))); |
561 for (int i = 0; i < (int)primary.size(); ++i) { | 578 t->setPresentationName("candidate"); |
562 all.push_back(primary[i]); | 579 m_document->addLayerToView(m_pane, t); |
563 } | 580 m_reAnalysisCandidates.push_back(t); |
564 for (int i = 0; i < (int)additional.size(); ++i) { | |
565 all.push_back(additional[i]); | |
566 } | |
567 | |
568 for (int i = 0; i < (int)all.size(); ++i) { | |
569 TimeValueLayer *t = qobject_cast<TimeValueLayer *>(all[i]); | |
570 if (t) { | |
571 PlayParameters *params = t->getPlayParameters(); | |
572 if (params) { | |
573 params->setPlayAudible(false); | |
574 } | 581 } |
575 t->setBaseColour | 582 } |
576 (ColourDatabase::getInstance()->getColourIndex(tr("Bright Orange"))); | 583 |
577 t->setPresentationName("candidate"); | 584 if (!all.empty()) { |
578 m_document->addLayerToView(m_pane, t); | 585 bool show = m_candidatesVisible; |
579 m_reAnalysisCandidates.push_back(t); | 586 m_candidatesVisible = !show; // to ensure the following takes effect |
580 } | 587 showPitchCandidates(show); |
581 } | 588 } |
582 | 589 |
583 if (!all.empty()) { | 590 CommandHistory::getInstance()->endCompoundOperation(); |
584 bool show = m_candidatesVisible; | 591 } |
585 m_candidatesVisible = !show; // to ensure the following takes effect | |
586 showPitchCandidates(show); | |
587 } | |
588 | |
589 CommandHistory::getInstance()->endCompoundOperation(); | |
590 | 592 |
591 emit layersChanged(); | 593 emit layersChanged(); |
592 } | 594 } |
593 | 595 |
594 bool | 596 bool |