Mercurial > hg > tony
diff src/MainWindow.cpp @ 198:bb391844e2aa
Switching pitch candidate no longer wraps around: you can't go higher than the highest or lower than the lowest (though you can go either "up" or "down" if none of the alternate candidates has been selected yet, regardless of whether the candidates are higher or lower than the actual pitch track)
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 11:39:28 +0000 |
parents | 797395e56489 |
children | 0ba33d6c0a71 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Wed Mar 05 11:31:55 2014 +0000 +++ b/src/MainWindow.cpp Wed Mar 05 11:39:28 2014 +0000 @@ -553,7 +553,7 @@ action->setStatusTip(tr("Switch to the next higher pitch candidate in the selected region")); m_keyReference->registerShortcut(action); connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp())); - connect(this, SIGNAL(canChangePitchCandidate(bool)), action, SLOT(setEnabled(bool))); + connect(this, SIGNAL(canChangeToHigherCandidate(bool)), action, SLOT(setEnabled(bool))); menu->addAction(action); m_rightButtonMenu->addAction(action); @@ -562,7 +562,7 @@ action->setStatusTip(tr("Switch to the next lower pitch candidate in the selected region")); m_keyReference->registerShortcut(action); connect(action, SIGNAL(triggered()), this, SLOT(switchPitchDown())); - connect(this, SIGNAL(canChangePitchCandidate(bool)), action, SLOT(setEnabled(bool))); + connect(this, SIGNAL(canChangeToLowerCandidate(bool)), action, SLOT(setEnabled(bool))); menu->addAction(action); m_rightButtonMenu->addAction(action); @@ -1055,6 +1055,10 @@ qobject_cast<TimeValueLayer *>(currentLayer)); bool pitchCandidatesVisible = m_analyser->arePitchCandidatesShown(); + bool haveHigher = + m_analyser->haveHigherPitchCandidate(); + bool haveLower = + m_analyser->haveLowerPitchCandidate(); emit canChangePlaybackSpeed(true); int v = m_playSpeed->value(); @@ -1062,6 +1066,8 @@ emit canSlowDownPlayback(v > m_playSpeed->minimum()); emit canChangePitchCandidate(pitchCandidatesVisible && haveSelection); + emit canChangeToHigherCandidate(pitchCandidatesVisible && haveSelection && haveHigher); + emit canChangeToLowerCandidate(pitchCandidatesVisible && haveSelection && haveLower); if (pitchCandidatesVisible) { m_showCandidatesAction->setText(tr("Hide Pitch Candidates"));