1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Workaround for bug 30: don't allow create-label-by-typing while playing unless the selection has been changed.

This commit is contained in:
BusinessmanProgrammerSteve 2010-05-02 02:39:46 +00:00
parent cd6848a912
commit bb9b9eeb27

View File

@ -1573,12 +1573,20 @@ bool LabelTrack::CaptureKey(wxKeyEvent & event)
{ {
if( IsGoodLabelFirstCharacter(keyCode, charCode) && !event.CmdDown() ){ if( IsGoodLabelFirstCharacter(keyCode, charCode) && !event.CmdDown() ){
AudacityProject * pProj = GetActiveProject(); AudacityProject * pProj = GetActiveProject();
CommandManager * cm = pProj->GetCommandManager();
if (pProj->GetAudioIOToken() > 0 && gAudioIO->IsStreamActive(pProj->GetAudioIOToken()) &&
cm && cm->GetKeyFromName(wxT("AddLabelPlaying")) == keyCode)
return false;
// IF Label already there, then don't add a new one on typing. // If we're playing, don't capture if the selection is the same as the
// playback region (this helps prevent label track creation from
// stealing unmodified kbd. shortcuts)
if (pProj->GetAudioIOToken() > 0 &&
gAudioIO->IsStreamActive(pProj->GetAudioIOToken()))
{
double t0, t1;
pProj->GetPlayRegion(&t0, &t1);
if (pProj->mViewInfo.sel0 == t0 && pProj->mViewInfo.sel1)
return false;
}
// If there's a label there already don't capture
if( GetLabelIndex( pProj->mViewInfo.sel0, pProj->mViewInfo.sel1) != wxNOT_FOUND ) if( GetLabelIndex( pProj->mViewInfo.sel0, pProj->mViewInfo.sel1) != wxNOT_FOUND )
return false; return false;