1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-20 14:21:33 +02:00

ESC key stops play as well as scrub, but not record. Details: ...

... If there is play but also an escapable drag action in TrackPanel, such as
a change of selection, then ESC aborts the drag.  A second ESC would stop play.

The event handling for these ESC actions may be in the wrong place though.  If
you ctrl-f6 during play so that the selection toolbar gets focus, then ESC
does not work to stop play.
This commit is contained in:
Paul Licameli 2016-04-20 13:12:39 -04:00
parent d2c8975f8a
commit d26395029f

View File

@ -1147,13 +1147,15 @@ void TrackPanel::MakeParentRedrawScrollbars()
void TrackPanel::HandleEscapeKey(bool down)
{
// Note that this dispatches some keystrokes even when track panel is not focused.
// So it works as a place for escaping from playing and scrub as well as other
// drag actions specific to track panel. If there is a drag and a play at the
// same time, the first ESC applies to the drag action only.
if (!down)
return;
auto &scrubber = GetProject()->GetScrubber();
if(scrubber.HasStartedScrubbing())
scrubber.StopScrubbing();
else switch (mMouseCapture)
switch (mMouseCapture)
{
case IsSelecting:
{
@ -1195,10 +1197,28 @@ void TrackPanel::HandleEscapeKey(bool down)
}
break;
default:
{
// Stop play, but not record, and only if ESC does
// nothing else. See comments at top of function.
auto project = GetProject();
auto token = project->GetAudioIOToken();
auto &scrubber = project->GetScrubber();
if(scrubber.HasStartedScrubbing())
// ESC out of scrubbing
scrubber.StopScrubbing();
else if(token > 0 &&
gAudioIO->IsAudioTokenActive(token) &&
gAudioIO->GetNumCaptureChannels() == 0)
// ESC out of other play (but not record)
GetProject()->OnStop();
// Not escaping from a mouse drag
return;
}
}
// Common part in all cases that do anything
// Common part in all cases that escape from a drag
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseMouse();